2007-11-09 08:02:18

by Ron Rindjunsky

[permalink] [raw]
Subject: [PATCH 0/14] mac80211/iwlwifi (#everything): integrate IEEE802.11n support

This series of patches splits into two parts:
- patches 1-7 add 802.11n support to mac80211.
- patches 8-14 demonstrates the use of the above mac80211's 802.11n framework through iwl4965 low level driver

In order to be compatible with the 802.11n requirements for an HT station,
patches 1-7 should not be treated as stand alone patches, but as a complete framework,
although separation to patches by subjects was made for ease of handling.
This applies to patches 8-14 as well.

The patches do _not_ break any existing driver.

patches were made (and tested to work) with wireless branch 2.6.24-rc1 (#everything)

The framework includes the following:
- HT probing.
- HT association.
- Support in Rx A-MSDU.
- Support in A-MPDU apackage contains the ddBA request.
- HT information and configuration delivery to both low-level driver and rate scaling.
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


2007-11-11 20:22:09

by Ron Rindjunsky

[permalink] [raw]
Subject: RE: [PATCH 07/14] mac80211: adding 802.11n configuration flows

I will fix all code remarks, thanks.

I would skip answering for each conf_ht callback remark and just relate
to the situation in general, and why I chose to do things currently this
way.

I think you are right, and current situation of all "config" callbacks
is a bit havocked.
On one hand we have the (*config)(struct ieee80211_hw *hw, struct
ieee80211_conf *conf) which I took as a reference to config_ht, and on
the other hand we have callbacks erp_ie_changed (erp) and conf_tx (WMM).
All of them are unique in use, though in general mean one thing to low
level driver - please change HW settings as configuration has been
changed, yet non gives indication on associated/unassociated states
change...
Currently I took an approach similar to that of erp and wmm, for clarity
to low level driver, but I was truly glad to see your remark in the
bottom

> Yeah this is what I was talking about. mac80211 really sucks with all
> this "has changed stuff". Hrmm. Michael, any time-frame on rewriting
the
> interface config stuff?

Now, I began to work on a solution for this problem (please refer to my
RFC "mac80211: [RFC] adding bss_config to low level driver ops"), in
which I wanted to unite all IE changes into one callback. If Michael is
already working on a more general solution for all "config" callbacks I
would be happy to contribute to his effort, or even continue my RFC to a
more solid patch, but until this will occur I just used similar approach
to already existing callbacks.

(and sorry for this long explanation...)

>> + *
>> + * @conf_ht: Configures low level driver with 802.11n HT data. Must
be >> atomic.

> Why is this a special callback when you pass struct ieee80211_conf?

>> +#ifdef CONFIG_MAC80211_HT
>> + int (*conf_ht)(struct ieee80211_hw *hw, struct ieee80211_conf
*conf);
>> +#endif /* CONFIG_MAC80211_HT */

> Shouldn't you use the if_conf callback then? I know that callback
needs
> to be rewritten to indicate what parameters changed, I think Michael
> wanted to do something in that direction? Similar to my filter flags
> change in how it'd work I guess.

>> +#ifdef CONFIG_MAC80211_HT
>> +
>> +/**
>> + * ieee80211_hw_config_ht should be used only after legacy
configuration
>> + * has been determined, as ht configuration depends upon the
hardware's
>> + * HT abilities for a _specific_ band.
>> + */

> This is part of ieee80211_hw_mode right? I have patches to remove
that,
> just to be clear on it, it's band specific not in any other way "mode"
> specific. So without digging through all the details I assume you're
> registering an 802.11 G mode with HT capabilities? That's pretty
warped,
> but yeah, mac80211 works that way right now. Crap. I should hurry up
and
> get that mode -> band change ready.

>> + conf->flags &= ~(IEEE80211_CONF_SUPPORT_HT_MODE);

>> + conf->flags &= ~(IEEE80211_CONF_SUPPORT_HT_MODE);

> No parentheses please.

Will fix

>> + conf->ht_conf.cap &= ~(IEEE80211_HT_CAP_MIMO_PS);

> Same here. If any of the defines need parentheses they should have
them
> built-in.

>> + for (i = 0; i < 16; i++)
>> + conf->ht_conf.supp_mcs_set[i] =
>> + mode->ht_info.supp_mcs_set[i] &
>> + req_ht_cap->supp_mcs_set[i];

> Hmm. No define for that 16?

Will fix

>> +#ifdef CONFIG_MAC80211_HT
>> + if (elems.ht_cap_elem && elems.ht_info_elem && elems.wmm_param
&&
>> + local->ops->conf_ht) {
>> + struct ieee80211_ht_bss_info bss_info;
>> +
>> + ieee80211_ht_cap_ie_to_ht_info(
>> + (struct ieee80211_ht_cap *)
>> + elems.ht_cap_elem, &sta->ht_info);
>> + ieee80211_ht_addt_info_ie_to_ht_bss_info(
>> + (struct ieee80211_ht_addt_info *)
>> + elems.ht_info_elem, &bss_info);
>> + ieee80211_hw_config_ht(local, 1, &sta->ht_info,
&bss_info);
>> + }
>> +#endif /* CONFIG_MAC80211_HT */

> Since it's part of if_conf, isn't it passed to the driver as part of
> such a call anyway later in this function? I don't see the need for
the
> special ht conf callback.

IMHO no, it doesn't as far as I can see in this flow.

>> + /* check if AP changed bss inforamation */
>> + if ((conf->ht_bss_conf.primary_channel !=
>> + bss_info.primary_channel) ||
>> + (conf->ht_bss_conf.bss_cap != bss_info.bss_cap) ||
>> + (conf->ht_bss_conf.bss_op_mode !=
bss_info.bss_op_mode))
>> + ieee80211_hw_config_ht(local, 1, &conf->ht_conf,
>> + &bss_info);

> Yeah this is what I was talking about. mac80211 really sucks with all
> this "has changed stuff". Hrmm. Michael, any time-frame on rewriting
the
> interface config stuff?

> johannes
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2007-11-19 15:25:59

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 06/14] mac80211: adding 802.11n essential A-MSDU Rxcapability


> This was assuming that there were never frames that would need special
> handling in the aggregate (i.e., need for special PAE or
> unencrypted/encrypted processing). Since the aggregate was encrypted as
> a single unit, the drop_unencrypted was not an issue. Same was, in
> practice, true for most of PAE processing. I don't think the initial
> EAPOL handshake is an issue, but at least in theory, there could be an
> EAPOL re-authentication happening at some point and if EAPOL frames
> require special processing, this would need to be taken into account.

Hmm. Management frames cannot be aggregated and EAPOL shouldn't need
special processing, but getting all this code into one block so the
compiler can optimise it is better nonetheless imho.

> Please note that data frame handling requires support for four addresses
> and plain 802.3 header would not be sufficient without some additional
> meta data. I would assume this to be doable, but some of the
> functionality will need to moved around to handle the 802.11 specific
> things first (like WDS interface selection) and then pass some meta data
> in addition to the frame.

Not sure about this. We do interface selection before the RX handlers
(well, we currently loop, but that can and ought to be improved). Hence,
at the point where we reframe the frame to 802.3 we no longer need any
extra data, do we?

> As long as the issues with encrypted vs. unencrypted frames can be
> resolved for both TX and RX in a way that handles the 802.1X and WPA
> cases, it should be fine passing EAPOL frames as normal data frames.

Well for TX we've already solved this with the monitor mode injection.
For RX, I'm not exactly sure about how things need to work. Can you
explain the 802.1X/WPA/dynamic WEP cases?

> In
> addition, bridging code should be told not to bridge this ethertype if
> that has not been done yet.

That should be easy enough to check/do.

johannes


Attachments:
signature.asc (828.00 B)
This is a digitally signed message part

2007-11-11 20:23:08

by Ron Rindjunsky

[permalink] [raw]
Subject: RE: [PATCH 06/14] mac80211: adding 802.11n essential A-MSDU Rxcapability

>> This patch adds the ability to receive and handle A-MSDU frames.

>> + u16 amsdu_frame;

> Why a u16 of all the available types? Maybe just 'bool'?

32 bit alignment of this struct, but it may confuse someone else in the
future, I agree. I'll change it to u8.

>> + switch (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
>> + case IEEE80211_FCTL_TODS:
>> + /* BSSID SA DA */
>> + if (unlikely(sdata->type != IEEE80211_IF_TYPE_AP &&
>> + sdata->type != IEEE80211_IF_TYPE_VLAN)) {
>> + printk(KERN_DEBUG "%s: dropped ToDS frame
(BSSID=%s"
>> + " SA=%s DA=%s)\n",
>> + dev->name, print_mac(mac, hdr->addr1),
>> + print_mac(mac, hdr->addr2),
>> + print_mac(mac, hdr->addr3));

> net_ratelimit()

Will do

>> + printk(KERN_DEBUG "%s: dropped FromDS&ToDS
frame"
>> + " (RA=%s TA=%s DA=%s SA=%s)\n",
>> + rx->dev->name, print_mac(mac,
hdr->addr1),
>> + print_mac(mac, hdr->addr2),
>> + print_mac(mac, hdr->addr3),
>> + print_mac(mac, hdr->addr4));

> ditto.

Will do

>> + if (net_ratelimit())
>> + printk(KERN_DEBUG "%s: dropped IBSS
frame"
>> + " (DA=%s SA=%s BSSID=%s)\n",
>> + dev->name, print_mac(mac,
hdr->addr1),
>> + print_mac(mac, hdr->addr2),
>> + print_mac(mac, hdr->addr3));

> Heh :)

>> + skb_reserve(frame, local->hw.extra_tx_headroom +
>> + sizeof(struct ethhdr));

> Hah. I knew there was an skb_reserve missing in the original code :)

> The one thing I'm not sure about here is the EAPOL frame handling. In
> theory, such frames could be part of an aggregation and thus we'll not
> get them to the right place. Then again, we haven't decided yet what
the
> right place is. Also, what happens with 802.1X port control?

I agree. Good point and thanks for the catch.
Would appreciate your opinion for next possible solution:
I'll Move ieee80211_rx_h_data_agg before ieee80211_rx_h_802_1x_pae, and
assuming I identify A-MSDU, I'll loop for each internal MSDU on:
ieee80211_rx_h_802_1x_pae
ieee80211_rx_h_drop_unencrypted
ieee80211_rx_h_data
return value of ieee80211_rx_h_data_agg to
__ieee80211_invoke_rx_handlers will be this small loop's return value

> johannes
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2007-11-13 16:03:19

by Ron Rindjunsky

[permalink] [raw]
Subject: RE: [PATCH 07/14] mac80211: adding 802.11n configuration flows

>> Now, I began to work on a solution for this problem (please refer to
my
>> RFC "mac80211: [RFC] adding bss_config to low level driver ops"), in
>> which I wanted to unite all IE changes into one callback.

> Oh right, I completely forgot about that, sorry. I should take another
> look, or would you like to repost that?

No problems, I'll re-base it to current code and re-send it

Ron

>> If Michael is
>> already working on a more general solution for all "config" callbacks
I
>> would be happy to contribute to his effort, or even continue my RFC
to a
>> more solid patch, but until this will occur I just used similar
approach
>> to already existing callbacks.

> I don't really know if he's working on it and I guess that if he is
he'd
> take your work as a base.

> johannes
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2007-11-09 20:18:15

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 03/14] mac80211: adding 802.11n HT framework definitions

Quick question:

> enum ieee80211_conf_flags {
> IEEE80211_CONF_SHORT_SLOT_TIME = 1<<0,
> IEEE80211_CONF_RADIOTAP = 1<<1,
> +#ifdef CONFIG_MAC80211_HT
> + IEEE80211_CONF_SUPPORT_HT_MODE = 1<<2,
> +#endif /* CONFIG_MAC80211_HT */

Why is this a configuration item? Does the PHY save power if you run it
only in 802.11a/b/g modes rather than N?

Also, I don't think we should have the ifdef there.

johannes


Attachments:
signature.asc (828.00 B)
This is a digitally signed message part

2007-11-11 20:22:09

by Ron Rindjunsky

[permalink] [raw]
Subject: RE: [PATCH 12/14] iwlwifi: 802.11n comply HT add station flow withmac80211 framework

>> + /* TODO - consider checking if mac80211 will allow
>> + * to query its station table - will help here */

>Care to explain what you mean and how it'd help?

Oops sorry, I have already took this remark out, it was just a reminder
for
me to ask you if you think that mac80211 should give the low-level
driver some kind of query option to its station table? It may save
double book keeping of station table to low-level driver?

>johannes
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2007-11-09 20:19:03

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 10/14] iwlwifi: 802.11n handling probe request HT IE


On Fri, 2007-11-09 at 10:02 +0200, Ron Rindjunsky wrote:
> This patch conforms the probe request's HT IE with the
> new structures used in iwlwifi HT.

Maybe the mac80211 hardware scan API should be changed to pass in the
probe request frame? That way, the driver wouldn't need to do all the
"directed vs. undirected scan", HT IE stuff etc.

johannes


Attachments:
signature.asc (828.00 B)
This is a digitally signed message part

2007-11-19 00:19:49

by Jouni Malinen

[permalink] [raw]
Subject: Re: [PATCH 06/14] mac80211: adding 802.11n essential A-MSDU Rxcapability

On Mon, Nov 12, 2007 at 05:45:42PM +0100, Johannes Berg wrote:

> > Would appreciate your opinion for next possible solution:
> > I'll Move ieee80211_rx_h_data_agg before ieee80211_rx_h_802_1x_pae, and
> > assuming I identify A-MSDU, I'll loop for each internal MSDU on:
> > ieee80211_rx_h_802_1x_pae
> > ieee80211_rx_h_drop_unencrypted
> > ieee80211_rx_h_data
> > return value of ieee80211_rx_h_data_agg to
> > __ieee80211_invoke_rx_handlers will be this small loop's return value
>
> I'm not sure I'd like to see such a thing. One thing I'm generally
> unhappy with here is how the handlers are in a list but there isn't a
> point in adding/removing any. Also, I'm not convinced that what you're
> saying will actually work because the handlers expect 802.11 frames so
> you'd have to make 802.11 frames out of the 802.3 frames you get...

When working with a proprietary (pre-802.11n) frame aggregation, we
ended up doing more or less this, i.e., converting the frames to a list
of skb's that had generated 802.11 headers and then passing them one by
one to ieee80211_rx_h_data. I don't know whether I would say that I
likeed the end result, but at least it seemed to work without major
problems.

This was assuming that there were never frames that would need special
handling in the aggregate (i.e., need for special PAE or
unencrypted/encrypted processing). Since the aggregate was encrypted as
a single unit, the drop_unencrypted was not an issue. Same was, in
practice, true for most of PAE processing. I don't think the initial
EAPOL handshake is an issue, but at least in theory, there could be an
EAPOL re-authentication happening at some point and if EAPOL frames
require special processing, this would need to be taken into account.

> What I originally wanted to do for this was to add a new
> "handle_data_frame" function that operates on 802.3 frames but has all
> the info available, is called from the rx_h_data handler and
> incorporates all the three callbacks you list above.That'd be similar to
> what I did with the crypto code (where we now only have a single handler
> doing it all rather than a bunch doing different pieces of the
> functionality)

Please note that data frame handling requires support for four addresses
and plain 802.3 header would not be sufficient without some additional
meta data. I would assume this to be doable, but some of the
functionality will need to moved around to handle the 802.11 specific
things first (like WDS interface selection) and then pass some meta data
in addition to the frame. This would get relatively close to the
MA-UNITDATA service primitives from the MAC (which do indeed only pass
two addresses; 802.3 header would just be one example of how this
information can be passed).

> You should be able to do this in the code right now because I removed
> the management interface and hence EAPOL frames aren't handled
> specially. Hostapd wants to have eapol frames on the management
> interface and 802.11 framed, but I don't understand that and would
> rather have it be done differently.

As long as the issues with encrypted vs. unencrypted frames can be
resolved for both TX and RX in a way that handles the 802.1X and WPA
cases, it should be fine passing EAPOL frames as normal data frames. In
addition, bridging code should be told not to bridge this ethertype if
that has not been done yet.

--
Jouni Malinen PGP id EFC895FA

2007-11-09 20:18:52

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 07/14] mac80211: adding 802.11n configuration flows


> + *
> + * @conf_ht: Configures low level driver with 802.11n HT data. Must be atomic.

Why is this a special callback when you pass struct ieee80211_conf?

> +#ifdef CONFIG_MAC80211_HT
> + int (*conf_ht)(struct ieee80211_hw *hw, struct ieee80211_conf *conf);
> +#endif /* CONFIG_MAC80211_HT */

Shouldn't you use the if_conf callback then? I know that callback needs
to be rewritten to indicate what parameters changed, I think Michael
wanted to do something in that direction? Similar to my filter flags
change in how it'd work I guess.

> +#ifdef CONFIG_MAC80211_HT
> +
> +/**
> + * ieee80211_hw_config_ht should be used only after legacy configuration
> + * has been determined, as ht configuration depends upon the hardware's
> + * HT abilities for a _specific_ band.
> + */

This is part of ieee80211_hw_mode right? I have patches to remove that,
just to be clear on it, it's band specific not in any other way "mode"
specific. So without digging through all the details I assume you're
registering an 802.11 G mode with HT capabilities? That's pretty warped,
but yeah, mac80211 works that way right now. Crap. I should hurry up and
get that mode -> band change ready.

> + conf->flags &= ~(IEEE80211_CONF_SUPPORT_HT_MODE);

> + conf->flags &= ~(IEEE80211_CONF_SUPPORT_HT_MODE);

No parentheses please.

> + conf->ht_conf.cap &= ~(IEEE80211_HT_CAP_MIMO_PS);

Same here. If any of the defines need parentheses they should have them
built-in.

> + for (i = 0; i < 16; i++)
> + conf->ht_conf.supp_mcs_set[i] =
> + mode->ht_info.supp_mcs_set[i] &
> + req_ht_cap->supp_mcs_set[i];

Hmm. No define for that 16?

> +#ifdef CONFIG_MAC80211_HT
> + if (elems.ht_cap_elem && elems.ht_info_elem && elems.wmm_param &&
> + local->ops->conf_ht) {
> + struct ieee80211_ht_bss_info bss_info;
> +
> + ieee80211_ht_cap_ie_to_ht_info(
> + (struct ieee80211_ht_cap *)
> + elems.ht_cap_elem, &sta->ht_info);
> + ieee80211_ht_addt_info_ie_to_ht_bss_info(
> + (struct ieee80211_ht_addt_info *)
> + elems.ht_info_elem, &bss_info);
> + ieee80211_hw_config_ht(local, 1, &sta->ht_info, &bss_info);
> + }
> +#endif /* CONFIG_MAC80211_HT */

Since it's part of if_conf, isn't it passed to the driver as part of
such a call anyway later in this function? I don't see the need for the
special ht conf callback.

> + /* check if AP changed bss inforamation */
> + if ((conf->ht_bss_conf.primary_channel !=
> + bss_info.primary_channel) ||
> + (conf->ht_bss_conf.bss_cap != bss_info.bss_cap) ||
> + (conf->ht_bss_conf.bss_op_mode != bss_info.bss_op_mode))
> + ieee80211_hw_config_ht(local, 1, &conf->ht_conf,
> + &bss_info);

Yeah this is what I was talking about. mac80211 really sucks with all
this "has changed stuff". Hrmm. Michael, any time-frame on rewriting the
interface config stuff?

johannes


Attachments:
signature.asc (828.00 B)
This is a digitally signed message part

2007-11-09 08:02:18

by Ron Rindjunsky

[permalink] [raw]
Subject: [PATCH 10/14] iwlwifi: 802.11n handling probe request HT IE

This patch conforms the probe request's HT IE with the
new structures used in iwlwifi HT.

Signed-off-by: Ron Rindjunsky <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl4965-base.c | 64 ++++++++++++---------------
1 files changed, 29 insertions(+), 35 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 1d0946f..c0852ae 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -1821,9 +1821,9 @@ static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate,

#ifdef CONFIG_IWL4965_HT
void static iwl_set_ht_capab(struct ieee80211_hw *hw,
- struct ieee80211_ht_capability *ht_cap,
- u8 use_wide_chan);
-#endif
+ struct ieee80211_ht_cap *ht_cap,
+ u8 use_current_config);
+#endif /* CONFIG_IWL4965_HT */

/**
* iwl_fill_probe_req - fill in all required fields and IE for probe request
@@ -1835,6 +1835,9 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv,
int len = 0;
u8 *pos = NULL;
u16 active_rates, ret_rates, cck_rates, active_rate_basic;
+#ifdef CONFIG_IWL4965_HT
+ struct ieee80211_hw_mode *mode;
+#endif /* CONFIG_IWL4965_HT */

/* Make sure there is enough space for the probe request,
* two mandatory IEs and the data */
@@ -1918,17 +1921,14 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv,
len += 2 + *pos;

#ifdef CONFIG_IWL4965_HT
- if (is_direct && priv->is_ht_enabled) {
- u8 use_wide_chan = 1;
-
- if (priv->channel_width != IWL_CHANNEL_WIDTH_40MHZ)
- use_wide_chan = 0;
+ mode = priv->hw->conf.mode;
+ if (mode->ht_info.ht_supported) {
pos += (*pos) + 1;
*pos++ = WLAN_EID_HT_CAPABILITY;
- *pos++ = sizeof(struct ieee80211_ht_capability);
- iwl_set_ht_capab(NULL, (struct ieee80211_ht_capability *)pos,
- use_wide_chan);
- len += 2 + sizeof(struct ieee80211_ht_capability);
+ *pos++ = sizeof(struct ieee80211_ht_cap);
+ iwl_set_ht_capab(priv->hw,
+ (struct ieee80211_ht_cap *)pos, 0);
+ len += 2 + sizeof(struct ieee80211_ht_cap);
}
#endif /*CONFIG_IWL4965_HT */

@@ -8160,31 +8160,25 @@ static int iwl_mac_conf_ht(struct ieee80211_hw *hw,
}

static void iwl_set_ht_capab(struct ieee80211_hw *hw,
- struct ieee80211_ht_capability *ht_cap,
- u8 use_wide_chan)
+ struct ieee80211_ht_cap *ht_cap,
+ u8 use_current_config)
{
- union ht_cap_info cap;
- union ht_param_info param_info;
+ struct ieee80211_conf *conf = &hw->conf;
+ struct ieee80211_hw_mode *mode = conf->mode;

- memset(&cap, 0, sizeof(union ht_cap_info));
- memset(&param_info, 0, sizeof(union ht_param_info));
-
- cap.maximal_amsdu_size = HT_IE_MAX_AMSDU_SIZE_4K;
- cap.green_field = 1;
- cap.short_GI20 = 1;
- cap.short_GI40 = 1;
- cap.supported_chan_width_set = use_wide_chan;
- cap.mimo_power_save_mode = 0x3;
-
- param_info.max_rx_ampdu_factor = CFG_HT_RX_AMPDU_FACTOR_DEF;
- param_info.mpdu_density = CFG_HT_MPDU_DENSITY_DEF;
- ht_cap->capabilities_info = (__le16) cpu_to_le16(cap.val);
- ht_cap->mac_ht_params_info = (u8) param_info.val;
-
- ht_cap->supported_mcs_set[0] = 0xff;
- ht_cap->supported_mcs_set[1] = 0xff;
- ht_cap->supported_mcs_set[4] =
- (cap.supported_chan_width_set) ? 0x1: 0x0;
+ if (use_current_config) {
+ ht_cap->cap_info = cpu_to_le16(conf->ht_conf.cap);
+ memcpy(ht_cap->supp_mcs_set,
+ conf->ht_conf.supp_mcs_set, 16);
+ } else {
+ ht_cap->cap_info = cpu_to_le16(mode->ht_info.cap);
+ memcpy(ht_cap->supp_mcs_set,
+ mode->ht_info.supp_mcs_set, 16);
+ }
+ ht_cap->ampdu_params_info =
+ (mode->ht_info.ampdu_factor & IEEE80211_HT_CAP_AMPDU_FACTOR) |
+ ((mode->ht_info.ampdu_density << 2) &
+ IEEE80211_HT_CAP_AMPDU_DENSITY);
}

static void iwl_mac_get_ht_capab(struct ieee80211_hw *hw,
--
1.5.3.3
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2007-11-13 16:03:18

by Ron Rindjunsky

[permalink] [raw]
Subject: RE: [PATCH 05/14] mac80211: adding 802.11n essential A-MPDUaddBAcapability

>> Well, aggregation handling is the next step if these patches are
>> acceptable... :)

> :)

>> You are right, A-MPDU is really in the bottom of the data plane
>> architecture, so in most cases _creating_ it will be an HW feature,
>> while A-MSDU should be implemented in a much higher level place in
the
>> flow.
>> Two reasons why I placed A-MPDU handling in the mac80211:
>> - A-MPDU demands a "session" level management (add BACK, del BACK,
BAR),
>> which looks to me more mac80211 oriented
>> - A-MPDU extends the "Access Category" of 11e into "Traffic
Identifier"
>> (TID) to give finer granularity of frames priority. As mac80211
already
>> handles prioritization in wme.c, it looked like a good starting
point.

> Ok, thanks for the clarification. That means that when you implement
> a-mpdu aggregation handling you'll have some way to tell the hardware
to
> aggregate the next N frames?

Absolutely. Furthermore, as the mac80211 will be the A-MPDU _session_
manager, it will receive requests to start/stop aggregations, and will
decide, upon HT information it has from association, low-driver
capabilities and A-MPDU starting session "handshake", if aggregation is
really desired and needed. This decision will be passed to HW and
aggregation will start/stop.

>> >> + /* TODO - add here aggregation support */
>>
>> > I think that comment is misleading. We don't add aggregation
support
>> > here but rather when adding it we must change this code, but
anyway.
>> > Don't bother.
>>
>> I can remove that, just a reference for development convenience.

Yes, I will rephrase it for clarity.

> Nah, it's fine. Or maybe rephrase it a bit if you care.
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2007-11-09 08:02:20

by Ron Rindjunsky

[permalink] [raw]
Subject: [PATCH 02/14] mac80211: adding 802.11n definitions in ieee80211.h

This patch adds several structs and definitions to ieee80211.h
to support 802.11n draft specifications.
As 802.11n depends on and extends the 802.11e standard in several issues,
there are also several definitions that belong to 802.11e.

Signed-off-by: Ron Rindjunsky <[email protected]>
---
include/linux/ieee80211.h | 117 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 117 insertions(+), 0 deletions(-)

Index: wl2_6_24_HT/include/linux/ieee80211.h
===================================================================
--- wl2_6_24_HT.orig/include/linux/ieee80211.h
+++ wl2_6_24_HT/include/linux/ieee80211.h
@@ -54,6 +54,8 @@
#define IEEE80211_STYPE_ACTION 0x00D0

/* control */
+#define IEEE80211_STYPE_BACK_REQ 0x0080
+#define IEEE80211_STYPE_BACK 0x0090
#define IEEE80211_STYPE_PSPOLL 0x00A0
#define IEEE80211_STYPE_RTS 0x00B0
#define IEEE80211_STYPE_CTS 0x00C0
@@ -185,6 +187,25 @@ struct ieee80211_mgmt {
u8 new_chan;
u8 switch_count;
} __attribute__((packed)) chan_switch;
+ struct{
+ u8 action_code;
+ u8 dialog_token;
+ __le16 capab;
+ __le16 timeout;
+ __le16 start_seq_num;
+ } __attribute__((packed)) addba_req;
+ struct{
+ u8 action_code;
+ u8 dialog_token;
+ __le16 status;
+ __le16 capab;
+ __le16 timeout;
+ } __attribute__((packed)) addba_resp;
+ struct{
+ u8 action_code;
+ __le16 params;
+ __le16 reason_code;
+ } __attribute__((packed)) delba;
} u;
} __attribute__ ((packed)) action;
} u;
@@ -205,6 +226,49 @@ struct ieee80211_cts {
u8 ra[6];
} __attribute__ ((packed));

+struct ieee80211_bar {
+ __le16 frame_control;
+ __le16 duration;
+ __u8 ra[6];
+ __u8 ta[6];
+ __u16 control;
+ __u16 start_seq_num;
+} __attribute__((packed));
+
+/* IEEE 802.11n elements */
+struct ieee80211_ht_cap {
+ __le16 cap_info;
+ u8 ampdu_params_info;
+ u8 supp_mcs_set[16];
+ __le16 extended_ht_cap_info;
+ __le32 tx_BF_cap_info;
+ u8 antenna_selection_info;
+} __attribute__ ((packed));
+
+struct ieee80211_ht_addt_info {
+ u8 control_chan;
+ u8 ht_param;
+ __le16 operation_mode;
+ __le16 stbc_param;
+ u8 basic_set[16];
+} __attribute__ ((packed));
+
+/* 802.11n HT capabilities masks */
+#define IEEE80211_HT_CAP_SUP_WIDTH 0x0002
+#define IEEE80211_HT_CAP_MIMO_PS 0x000C
+#define IEEE80211_HT_CAP_GRN_FLD 0x0010
+#define IEEE80211_HT_CAP_SGI_20 0x0020
+#define IEEE80211_HT_CAP_SGI_40 0x0040
+#define IEEE80211_HT_CAP_DELAY_BA 0x0400
+#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
+#define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03
+#define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C
+/* 802.11n HT IE masks */
+#define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03
+#define IEEE80211_HT_IE_CHA_WIDTH 0x04
+#define IEEE80211_HT_IE_HT_PROTECTION 0x0003
+#define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004
+#define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010

/* Authentication algorithms */
#define WLAN_AUTH_OPEN 0
@@ -271,6 +335,18 @@ enum ieee80211_statuscode {
WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
+ /* 802.11e */
+ WLAN_STATUS_UNSPECIFIED_QOS = 32,
+ WLAN_STATUS_ASSOC_DENIED_NOBANDWIDTH = 33,
+ WLAN_STATUS_ASSOC_DENIED_LOWACK = 34,
+ WLAN_STATUS_ASSOC_DENIED_UNSUPP_QOS = 35,
+ WLAN_STATUS_REQUEST_DECLINED = 37,
+ WLAN_STATUS_INVALID_QOS_PARAM = 38,
+ WLAN_STATUS_CHANGE_TSPEC = 39,
+ WLAN_STATUS_WAIT_TS_DELAY = 47,
+ WLAN_STATUS_NO_DIRECT_LINK = 48,
+ WLAN_STATUS_STA_NOT_PRESENT = 49,
+ WLAN_STATUS_STA_NOT_QSTA = 50,
};


@@ -301,6 +377,16 @@ enum ieee80211_reasoncode {
WLAN_REASON_INVALID_RSN_IE_CAP = 22,
WLAN_REASON_IEEE8021X_FAILED = 23,
WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
+ /* 802.11e */
+ WLAN_REASON_DISASSOC_UNSPECIFIED_QOS = 32,
+ WLAN_REASON_DISASSOC_QAP_NO_BANDWIDTH = 33,
+ WLAN_REASON_DISASSOC_LOW_ACK = 34,
+ WLAN_REASON_DISASSOC_QAP_EXCEED_TXOP = 35,
+ WLAN_REASON_QSTA_LEAVE_QBSS = 36,
+ WLAN_REASON_QSTA_NOT_USE = 37,
+ WLAN_REASON_QSTA_REQUIRE_SETUP = 38,
+ WLAN_REASON_QSTA_TIMEOUT = 39,
+ WLAN_REASON_QSTA_CIPHER_NOT_SUPP = 45,
};


@@ -319,6 +405,15 @@ enum ieee80211_eid {
WLAN_EID_HP_PARAMS = 8,
WLAN_EID_HP_TABLE = 9,
WLAN_EID_REQUEST = 10,
+ /* 802.11e */
+ WLAN_EID_QBSS_LOAD = 11,
+ WLAN_EID_EDCA_PARAM_SET = 12,
+ WLAN_EID_TSPEC = 13,
+ WLAN_EID_TCLAS = 14,
+ WLAN_EID_SCHEDULE = 15,
+ WLAN_EID_TS_DELAY = 43,
+ WLAN_EID_TCLAS_PROCESSING = 44,
+ WLAN_EID_QOS_CAPA = 46,
/* 802.11h */
WLAN_EID_PWR_CONSTRAINT = 32,
WLAN_EID_PWR_CAPABILITY = 33,
@@ -333,6 +428,9 @@ enum ieee80211_eid {
/* 802.11g */
WLAN_EID_ERP_INFO = 42,
WLAN_EID_EXT_SUPP_RATES = 50,
+ /* 802.11n */
+ WLAN_EID_HT_CAPABILITY = 45,
+ WLAN_EID_HT_EXTRA_INFO = 61,
/* 802.11i */
WLAN_EID_RSN = 48,
WLAN_EID_WPA = 221,
@@ -341,6 +439,25 @@ enum ieee80211_eid {
WLAN_EID_QOS_PARAMETER = 222
};

+/* Action category code */
+enum ieee80211_category {
+ WLAN_CATEGORY_SPECTRUM_MGMT = 0,
+ WLAN_CATEGORY_QOS = 1,
+ WLAN_CATEGORY_DLS = 2,
+ WLAN_CATEGORY_BACK = 3,
+ WLAN_CATEGORY_WMM = 17,
+};
+
+/* BACK action code */
+enum ieee80211_back_actioncode {
+ WLAN_ACTION_ADDBA_REQ = 0,
+ WLAN_ACTION_ADDBA_RESP = 1,
+ WLAN_ACTION_DELBA = 2,
+};
+
+/* A-MSDU 802.11n */
+#define IEEE80211_QOS_CONTROL_A_MSDU_PRESENT 0x0080
+
/* cipher suite selectors */
#define WLAN_CIPHER_SUITE_USE_GROUP 0x000FAC00
#define WLAN_CIPHER_SUITE_WEP40 0x000FAC01
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2007-11-09 08:02:19

by Ron Rindjunsky

[permalink] [raw]
Subject: [PATCH 04/14] mac80211: adding 802.11n IEs handling

This patch presents the ability to parse and compose HT IEs, and to put
the IE relevant data inside the mac80211's internal HT structures

Signed-off-by: Ron Rindjunsky <[email protected]>
---
net/mac80211/ieee80211_i.h | 11 ++++
net/mac80211/ieee80211_sta.c | 106 ++++++++++++++++++++++++++++++++++++++++-
2 files changed, 114 insertions(+), 3 deletions(-)

Index: wl2_6_24_HT/net/mac80211/ieee80211_i.h
===================================================================
--- wl2_6_24_HT.orig/net/mac80211/ieee80211_i.h
+++ wl2_6_24_HT/net/mac80211/ieee80211_i.h
@@ -89,6 +89,10 @@ struct ieee80211_sta_bss {
size_t rsn_ie_len;
u8 *wmm_ie;
size_t wmm_ie_len;
+#ifdef CONFIG_MAC80211_HT
+ u8 *ht_ie;
+ size_t ht_ie_len;
+#endif /* CONFIG_MAC80211_HT */
#define IEEE80211_MAX_SUPP_RATES 32
u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
size_t supp_rates_len;
@@ -759,6 +763,13 @@ int ieee80211_sta_deauthenticate(struct
int ieee80211_sta_disassociate(struct net_device *dev, u16 reason);
void ieee80211_erp_info_change_notify(struct net_device *dev, u8 changes);
void ieee80211_reset_erp_info(struct net_device *dev);
+#ifdef CONFIG_MAC80211_HT
+int ieee80211_ht_cap_ie_to_ht_info(struct ieee80211_ht_cap *ht_cap_ie,
+ struct ieee80211_ht_info *ht_info);
+int ieee80211_ht_addt_info_ie_to_ht_bss_info(
+ struct ieee80211_ht_addt_info *ht_add_info_ie,
+ struct ieee80211_ht_bss_info *bss_info);
+#endif /* CONFIG_MAC80211_HT */

/* ieee80211_iface.c */
int ieee80211_if_add(struct net_device *dev, const char *name,
Index: wl2_6_24_HT/net/mac80211/ieee80211_sta.c
===================================================================
--- wl2_6_24_HT.orig/net/mac80211/ieee80211_sta.c
+++ wl2_6_24_HT/net/mac80211/ieee80211_sta.c
@@ -90,7 +90,10 @@ struct ieee802_11_elems {
u8 *ext_supp_rates;
u8 *wmm_info;
u8 *wmm_param;
-
+#ifdef CONFIG_MAC80211_HT
+ u8 *ht_cap_elem;
+ u8 *ht_info_elem;
+#endif /* CONFIG_MAC80211_HT */
/* length of them, respectively */
u8 ssid_len;
u8 supp_rates_len;
@@ -106,6 +109,10 @@ struct ieee802_11_elems {
u8 ext_supp_rates_len;
u8 wmm_info_len;
u8 wmm_param_len;
+#ifdef CONFIG_MAC80211_HT
+ u8 ht_cap_elem_len;
+ u8 ht_info_elem_len;
+#endif /* CONFIG_MAC80211_HT */
};

static void ieee802_11_parse_elems(u8 *start, size_t len,
@@ -190,6 +197,16 @@ static void ieee802_11_parse_elems(u8 *s
elems->ext_supp_rates = pos;
elems->ext_supp_rates_len = elen;
break;
+#ifdef CONFIG_MAC80211_HT
+ case WLAN_EID_HT_CAPABILITY:
+ elems->ht_cap_elem = pos;
+ elems->ht_cap_elem_len = elen;
+ break;
+ case WLAN_EID_HT_EXTRA_INFO:
+ elems->ht_info_elem = pos;
+ elems->ht_info_elem_len = elen;
+ break;
+#endif /* CONFIG_MAC80211_HT */
default:
break;
}
@@ -332,6 +349,55 @@ static void ieee80211_handle_erp_ie(stru
ieee80211_erp_info_change_notify(dev, changes);
}

+#ifdef CONFIG_MAC80211_HT
+
+int ieee80211_ht_cap_ie_to_ht_info(struct ieee80211_ht_cap *ht_cap_ie,
+ struct ieee80211_ht_info *ht_info)
+{
+
+ if (ht_info == NULL)
+ return -EINVAL;
+
+ memset(ht_info, 0, sizeof(*ht_info));
+
+ if (ht_cap_ie) {
+ u8 ampdu_info = ht_cap_ie->ampdu_params_info;
+
+ ht_info->ht_supported = 1;
+ ht_info->cap = le16_to_cpu(ht_cap_ie->cap_info);
+ ht_info->ampdu_factor =
+ ampdu_info & IEEE80211_HT_CAP_AMPDU_FACTOR;
+ ht_info->ampdu_density =
+ (ampdu_info & IEEE80211_HT_CAP_AMPDU_DENSITY) >> 2;
+ memcpy(ht_info->supp_mcs_set, ht_cap_ie->supp_mcs_set, 16);
+ } else
+ ht_info->ht_supported = 0;
+
+ return 0;
+}
+
+int ieee80211_ht_addt_info_ie_to_ht_bss_info(
+ struct ieee80211_ht_addt_info *ht_add_info_ie,
+ struct ieee80211_ht_bss_info *bss_info)
+{
+ if (bss_info == NULL)
+ return -EINVAL;
+
+ memset(bss_info, 0, sizeof(*bss_info));
+
+ if (ht_add_info_ie) {
+ u16 op_mode;
+ op_mode = le16_to_cpu(ht_add_info_ie->operation_mode);
+
+ bss_info->primary_channel = ht_add_info_ie->control_chan;
+ bss_info->bss_cap = ht_add_info_ie->ht_param;
+ bss_info->bss_op_mode = (u8)(op_mode & 0xff);
+ }
+
+ return 0;
+}
+
+#endif /* CONFIG_MAC80211_HT */

static void ieee80211_sta_send_associnfo(struct net_device *dev,
struct ieee80211_if_sta *ifsta)
@@ -630,6 +696,21 @@ static void ieee80211_send_assoc(struct
*pos++ = 1; /* WME ver */
*pos++ = 0;
}
+#ifdef CONFIG_MAC80211_HT
+ /* wmm support is a must to HT */
+ if (wmm && mode->ht_info.ht_supported) {
+ __le16 tmp = cpu_to_le16(mode->ht_info.cap);
+ 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));
+ memcpy(pos, &tmp, sizeof(u16));
+ pos += sizeof(u16);
+ *pos++ = (mode->ht_info.ampdu_factor |
+ (mode->ht_info.ampdu_density << 2));
+ memcpy(pos, mode->ht_info.supp_mcs_set, 16);
+ }
+#endif /* CONFIG_MAC80211_HT */

kfree(ifsta->assocreq_ies);
ifsta->assocreq_ies_len = (skb->data + skb->len) - ies;
@@ -1384,6 +1465,9 @@ static void ieee80211_rx_bss_free(struct
kfree(bss->wpa_ie);
kfree(bss->rsn_ie);
kfree(bss->wmm_ie);
+#ifdef CONFIG_MAC80211_HT
+ kfree(bss->ht_ie);
+#endif /* CONFIG_MAC80211_HT */
kfree(bss);
}

@@ -1631,8 +1715,24 @@ static void ieee80211_rx_bss_info(struct
bss->wmm_ie = NULL;
bss->wmm_ie_len = 0;
}
-
-
+#ifdef CONFIG_MAC80211_HT
+ if (elems.ht_cap_elem &&
+ (!bss->ht_ie || bss->ht_ie_len != elems.ht_cap_elem_len ||
+ memcmp(bss->ht_ie, elems.ht_cap_elem, elems.ht_cap_elem_len))) {
+ kfree(bss->ht_ie);
+ bss->ht_ie = kmalloc(elems.ht_cap_elem_len + 2, GFP_ATOMIC);
+ if (bss->ht_ie) {
+ memcpy(bss->ht_ie, elems.ht_cap_elem - 2,
+ elems.ht_cap_elem_len + 2);
+ bss->ht_ie_len = elems.ht_cap_elem_len + 2;
+ } else
+ bss->ht_ie_len = 0;
+ } else if (!elems.ht_cap_elem && bss->ht_ie) {
+ kfree(bss->ht_ie);
+ bss->ht_ie = NULL;
+ bss->ht_ie_len = 0;
+ }
+#endif /* CONFIG_MAC80211_HT */
bss->hw_mode = rx_status->phymode;
bss->freq = rx_status->freq;
if (channel != rx_status->channel &&
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2007-11-09 08:02:18

by Ron Rindjunsky

[permalink] [raw]
Subject: [PATCH 11/14] iwlwifi: 802.11n comply HT self configuration flow with mac80211 framework

This patch conforms HW configuration changes according to new mac80211's
HT framework

Signed-off-by: Ron Rindjunsky <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-4965.c | 40 +++---
drivers/net/wireless/iwlwifi/iwl-4965.h | 7 +-
drivers/net/wireless/iwlwifi/iwl4965-base.c | 186 +++++++--------------------
3 files changed, 66 insertions(+), 167 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 0a6f6ec..257dc9d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -87,8 +87,8 @@ static int is_fat_channel(__le32 rxon_flags)
static u8 is_single_stream(struct iwl_priv *priv)
{
#ifdef CONFIG_IWL4965_HT
- if (!priv->is_ht_enabled || !priv->current_assoc_ht.is_ht ||
- (priv->active_rate_ht[1] == 0) ||
+ if (!priv->current_ht_config.is_ht ||
+ (priv->current_ht_config.supp_mcs_set[1] == 0) ||
(priv->ps_mode == IWL_MIMO_PS_STATIC))
return 1;
#else
@@ -4369,27 +4369,27 @@ static u8 iwl_is_channel_extension(struct iwl_priv *priv, int phymode,
}

static u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv,
- const struct sta_ht_info *ht_info)
+ struct ieee80211_ht_info *sta_ht_inf)
{
+ struct iwl_ht_info *iwl_ht_conf = &priv->current_ht_config;

- if (priv->channel_width != IWL_CHANNEL_WIDTH_40MHZ)
+ if ((!iwl_ht_conf->is_ht) ||
+ (iwl_ht_conf->supported_chan_width != IWL_CHANNEL_WIDTH_40MHZ) ||
+ (iwl_ht_conf->extension_chan_offset == IWL_EXT_CHANNEL_OFFSET_AUTO))
return 0;

- if (ht_info->supported_chan_width != IWL_CHANNEL_WIDTH_40MHZ)
- return 0;
-
- if (ht_info->extension_chan_offset == IWL_EXT_CHANNEL_OFFSET_AUTO)
- return 0;
+ if (sta_ht_inf) {
+ if ((!sta_ht_inf->ht_supported) ||
+ (!sta_ht_inf->cap & IEEE80211_HT_CAP_SUP_WIDTH))
+ return 0;
+ }

- /* no fat tx allowed on 2.4GHZ */
- if (priv->phymode != MODE_IEEE80211A)
- return 0;
return (iwl_is_channel_extension(priv, priv->phymode,
- ht_info->control_channel,
- ht_info->extension_chan_offset));
+ iwl_ht_conf->control_channel,
+ iwl_ht_conf->extension_chan_offset));
}

-void iwl4965_set_rxon_ht(struct iwl_priv *priv, struct sta_ht_info *ht_info)
+void iwl4965_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info)
{
struct iwl_rxon_cmd *rxon = &priv->staging_rxon;
u32 val;
@@ -4397,7 +4397,7 @@ void iwl4965_set_rxon_ht(struct iwl_priv *priv, struct sta_ht_info *ht_info)
if (!ht_info->is_ht)
return;

- if (iwl_is_fat_tx_allowed(priv, ht_info))
+ if (iwl_is_fat_tx_allowed(priv, NULL))
rxon->flags |= RXON_FLG_CHANNEL_MODE_MIXED_MSK;
else
rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MIXED_MSK |
@@ -4427,20 +4427,18 @@ void iwl4965_set_rxon_ht(struct iwl_priv *priv, struct sta_ht_info *ht_info)
break;
}

- val = ht_info->operating_mode;
+ val = ht_info->ht_protection;

rxon->flags |= cpu_to_le32(val << RXON_FLG_HT_OPERATING_MODE_POS);

- priv->active_rate_ht[0] = ht_info->supp_rates[0];
- priv->active_rate_ht[1] = ht_info->supp_rates[1];
iwl4965_set_rxon_chain(priv);

IWL_DEBUG_ASSOC("supported HT rate 0x%X %X "
"rxon flags 0x%X operation mode :0x%X "
"extension channel offset 0x%x "
"control chan %d\n",
- priv->active_rate_ht[0], priv->active_rate_ht[1],
- le32_to_cpu(rxon->flags), ht_info->operating_mode,
+ ht_info->supp_mcs_set[0], ht_info->supp_mcs_set[1],
+ le32_to_cpu(rxon->flags), ht_info->ht_protection,
ht_info->extension_chan_offset,
ht_info->control_channel);
return;
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h
index 4a54aad..56de960 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.h
@@ -729,7 +729,7 @@ extern int iwl_hw_channel_switch(struct iwl_priv *priv, u16 channel);
extern int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index);

struct iwl_priv;
-struct sta_ht_info;
+struct iwl_ht_info;

/*
* Forward declare iwl-4965.c functions for iwl-base.c
@@ -742,9 +742,6 @@ extern int iwl4965_tx_queue_update_wr_ptr(struct iwl_priv *priv,
u16 byte_cnt);
extern void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr,
int is_ap);
-extern void iwl4965_set_rxon_ht(struct iwl_priv *priv,
- struct sta_ht_info *ht_info);
-
extern void iwl4965_set_rxon_chain(struct iwl_priv *priv);
extern int iwl4965_tx_cmd(struct iwl_priv *priv, struct iwl_cmd *out_cmd,
u8 sta_id, dma_addr_t txcmd_phys,
@@ -766,6 +763,8 @@ extern void iwl4965_rf_kill_ct_config(struct iwl_priv *priv);
#ifdef CONFIG_IWL4965_HT
extern void iwl4965_init_ht_hw_capab(struct ieee80211_ht_info *ht_info,
int mode);
+extern void iwl4965_set_rxon_ht(struct iwl_priv *priv,
+ struct iwl_ht_info *ht_info);
#ifdef CONFIG_IWL4965_HT_AGG
extern int iwl_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da,
u16 tid, u16 *start_seq_num);
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index c0852ae..60fa619 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -2057,7 +2057,7 @@ static void iwl_activate_qos(struct iwl_priv *priv, u8 force)
QOS_PARAM_FLG_UPDATE_EDCA_MSK;

#ifdef CONFIG_IWL4965_HT
- if (priv->is_ht_enabled && priv->current_assoc_ht.is_ht)
+ if (priv->current_ht_config.is_ht)
priv->qos_data.def_qos_parm.qos_flags |= QOS_PARAM_FLG_TGN_MSK;
#endif /* CONFIG_IWL4965_HT */

@@ -7124,13 +7124,8 @@ static void iwl_bg_post_associate(struct work_struct *data)
priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK;

#ifdef CONFIG_IWL4965_HT
- if (priv->is_ht_enabled && priv->current_assoc_ht.is_ht)
- iwl4965_set_rxon_ht(priv, &priv->current_assoc_ht);
- else {
- priv->active_rate_ht[0] = 0;
- priv->active_rate_ht[1] = 0;
- priv->current_channel_width = IWL_CHANNEL_WIDTH_20MHZ;
- }
+ if (priv->current_ht_config.is_ht)
+ iwl4965_set_rxon_ht(priv, &priv->current_ht_config);
#endif /* CONFIG_IWL4965_HT*/
iwl4965_set_rxon_chain(priv);
priv->staging_rxon.assoc_id = cpu_to_le16(priv->assoc_id);
@@ -7893,7 +7888,7 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
priv->lq_mngr.lq_ready = 0;
#ifdef CONFIG_IWL4965_HT
spin_lock_irqsave(&priv->lock, flags);
- memset(&priv->current_assoc_ht, 0, sizeof(struct sta_ht_info));
+ memset(&priv->current_ht_config, 0, sizeof(struct iwl_ht_info));
spin_unlock_irqrestore(&priv->lock, flags);
#ifdef CONFIG_IWL4965_HT_AGG
/* if (priv->lq_mngr.agg_ctrl.granted_ba)
@@ -8013,132 +8008,58 @@ static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
}

#ifdef CONFIG_IWL4965_HT
-union ht_cap_info {
- struct {
- u16 advanced_coding_cap :1;
- u16 supported_chan_width_set :1;
- u16 mimo_power_save_mode :2;
- u16 green_field :1;
- u16 short_GI20 :1;
- u16 short_GI40 :1;
- u16 tx_stbc :1;
- u16 rx_stbc :1;
- u16 beam_forming :1;
- u16 delayed_ba :1;
- u16 maximal_amsdu_size :1;
- u16 cck_mode_at_40MHz :1;
- u16 psmp_support :1;
- u16 stbc_ctrl_frame_support :1;
- u16 sig_txop_protection_support :1;
- };
- u16 val;
-} __attribute__ ((packed));
-
-union ht_param_info{
- struct {
- u8 max_rx_ampdu_factor :2;
- u8 mpdu_density :3;
- u8 reserved :3;
- };
- u8 val;
-} __attribute__ ((packed));
-
-union ht_exra_param_info {
- struct {
- u8 ext_chan_offset :2;
- u8 tx_chan_width :1;
- u8 rifs_mode :1;
- u8 controlled_access_only :1;
- u8 service_interval_granularity :3;
- };
- u8 val;
-} __attribute__ ((packed));
-
-union ht_operation_mode{
- struct {
- u16 op_mode :2;
- u16 non_GF :1;
- u16 reserved :13;
- };
- u16 val;
-} __attribute__ ((packed));

-
-static int sta_ht_info_init(struct ieee80211_ht_capability *ht_cap,
- struct ieee80211_ht_additional_info *ht_extra,
- struct sta_ht_info *ht_info_ap,
- struct sta_ht_info *ht_info)
+static void iwl_ht_info_fill(struct ieee80211_conf *conf, struct iwl_priv *priv)
{
- union ht_cap_info cap;
- union ht_operation_mode op_mode;
- union ht_param_info param_info;
- union ht_exra_param_info extra_param_info;
+ struct iwl_ht_info *iwl_conf = &priv->current_ht_config;
+ struct ieee80211_ht_info *ht_conf = &conf->ht_conf;
+ struct ieee80211_ht_bss_info *ht_bss_conf = &conf->ht_bss_conf;

IWL_DEBUG_MAC80211("enter: \n");

- if (!ht_info) {
- IWL_DEBUG_MAC80211("leave: ht_info is NULL\n");
- return -1;
+ if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE)) {
+ iwl_conf->is_ht = 0;
+ return;
}

- if (ht_cap) {
- cap.val = (u16) le16_to_cpu(ht_cap->capabilities_info);
- param_info.val = ht_cap->mac_ht_params_info;
- ht_info->is_ht = 1;
- if (cap.short_GI20)
- ht_info->sgf |= 0x1;
- if (cap.short_GI40)
- ht_info->sgf |= 0x2;
- ht_info->is_green_field = cap.green_field;
- ht_info->max_amsdu_size = cap.maximal_amsdu_size;
- ht_info->supported_chan_width = cap.supported_chan_width_set;
- ht_info->tx_mimo_ps_mode = cap.mimo_power_save_mode;
- memcpy(ht_info->supp_rates, ht_cap->supported_mcs_set, 16);
-
- ht_info->ampdu_factor = param_info.max_rx_ampdu_factor;
- ht_info->mpdu_density = param_info.mpdu_density;
-
- IWL_DEBUG_MAC80211("SISO mask 0x%X MIMO mask 0x%X \n",
- ht_cap->supported_mcs_set[0],
- ht_cap->supported_mcs_set[1]);
-
- if (ht_info_ap) {
- ht_info->control_channel = ht_info_ap->control_channel;
- ht_info->extension_chan_offset =
- ht_info_ap->extension_chan_offset;
- ht_info->tx_chan_width = ht_info_ap->tx_chan_width;
- ht_info->operating_mode = ht_info_ap->operating_mode;
- }
-
- if (ht_extra) {
- extra_param_info.val = ht_extra->ht_param;
- ht_info->control_channel = ht_extra->control_chan;
- ht_info->extension_chan_offset =
- extra_param_info.ext_chan_offset;
- ht_info->tx_chan_width = extra_param_info.tx_chan_width;
- op_mode.val = (u16)
- le16_to_cpu(ht_extra->operation_mode);
- ht_info->operating_mode = op_mode.op_mode;
- IWL_DEBUG_MAC80211("control channel %d\n",
- ht_extra->control_chan);
- }
- } else
- ht_info->is_ht = 0;
-
+ iwl_conf->is_ht = 1;
+ priv->ps_mode = (u8)((ht_conf->cap & IEEE80211_HT_CAP_MIMO_PS) >> 2);
+
+ if (ht_conf->cap & IEEE80211_HT_CAP_SGI_20)
+ iwl_conf->sgf |= 0x1;
+ if (ht_conf->cap & IEEE80211_HT_CAP_SGI_40)
+ iwl_conf->sgf |= 0x2;
+
+ iwl_conf->is_green_field = !!(ht_conf->cap & IEEE80211_HT_CAP_GRN_FLD);
+ iwl_conf->max_amsdu_size =
+ !!(ht_conf->cap & IEEE80211_HT_CAP_MAX_AMSDU);
+ iwl_conf->supported_chan_width =
+ !!(ht_conf->cap & IEEE80211_HT_CAP_SUP_WIDTH);
+ iwl_conf->tx_mimo_ps_mode =
+ (u8)((ht_conf->cap & IEEE80211_HT_CAP_MIMO_PS) >> 2);
+ memcpy(iwl_conf->supp_mcs_set, ht_conf->supp_mcs_set, 16);
+
+ iwl_conf->control_channel = ht_bss_conf->primary_channel;
+ iwl_conf->extension_chan_offset =
+ ht_bss_conf->bss_cap & IEEE80211_HT_IE_CHA_SEC_OFFSET;
+ iwl_conf->tx_chan_width =
+ !!(ht_bss_conf->bss_cap & IEEE80211_HT_IE_CHA_WIDTH);
+ iwl_conf->ht_protection =
+ ht_bss_conf->bss_op_mode & IEEE80211_HT_IE_HT_PROTECTION;
+ iwl_conf->non_GF_STA_present =
+ !!(ht_bss_conf->bss_op_mode & IEEE80211_HT_IE_NON_GF_STA_PRSNT);
+
+ IWL_DEBUG_MAC80211("control channel %d\n",
+ iwl_conf->control_channel);
IWL_DEBUG_MAC80211("leave\n");
- return 0;
}

-static int iwl_mac_conf_ht(struct ieee80211_hw *hw,
- struct ieee80211_ht_capability *ht_cap,
- struct ieee80211_ht_additional_info *ht_extra)
+static int iwl_mac_conf_ht(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
{
struct iwl_priv *priv = hw->priv;
- int rs;

IWL_DEBUG_MAC80211("enter: \n");
-
- rs = sta_ht_info_init(ht_cap, ht_extra, NULL, &priv->current_assoc_ht);
+ iwl_ht_info_fill(conf, priv);
iwl4965_set_rxon_chain(priv);

if (priv && priv->assoc_id &&
@@ -8153,9 +8074,8 @@ static int iwl_mac_conf_ht(struct ieee80211_hw *hw,
spin_unlock_irqrestore(&priv->lock, flags);
}

- IWL_DEBUG_MAC80211("leave: control channel %d\n",
- ht_extra->control_chan);
- return rs;
+ IWL_DEBUG_MAC80211("leave:\n");
+ return 0;

}

@@ -8181,23 +8101,6 @@ static void iwl_set_ht_capab(struct ieee80211_hw *hw,
IEEE80211_HT_CAP_AMPDU_DENSITY);
}

-static void iwl_mac_get_ht_capab(struct ieee80211_hw *hw,
- struct ieee80211_ht_capability *ht_cap)
-{
- u8 use_wide_channel = 1;
- struct iwl_priv *priv = hw->priv;
-
- IWL_DEBUG_MAC80211("enter: \n");
- if (priv->channel_width != IWL_CHANNEL_WIDTH_40MHZ)
- use_wide_channel = 0;
-
- /* no fat tx allowed on 2.4GHZ */
- if (priv->phymode != MODE_IEEE80211A)
- use_wide_channel = 0;
-
- iwl_set_ht_capab(hw, ht_cap, use_wide_channel);
- IWL_DEBUG_MAC80211("leave: \n");
-}
#endif /*CONFIG_IWL4965_HT*/

/*****************************************************************************
@@ -8914,7 +8817,6 @@ static struct ieee80211_ops iwl_hw_ops = {
.erp_ie_changed = iwl_mac_erp_ie_changed,
#ifdef CONFIG_IWL4965_HT
.conf_ht = iwl_mac_conf_ht,
- .get_ht_capab = iwl_mac_get_ht_capab,
#ifdef CONFIG_IWL4965_HT_AGG
.ht_tx_agg_start = iwl_mac_ht_tx_agg_start,
.ht_tx_agg_stop = iwl_mac_ht_tx_agg_stop,
--
1.5.3.3
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2007-11-09 20:18:30

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 02/14] mac80211: adding 802.11n definitions in ieee80211.h



> +struct ieee80211_bar {

> +struct ieee80211_ht_addt_info {

I'd appreciate comments what the abbreviations mean. I know bar (block
ack request) but not sure about addt (add TS?)

johannes


Attachments:
signature.asc (828.00 B)
This is a digitally signed message part

2007-11-12 16:48:14

by Johannes Berg

[permalink] [raw]
Subject: RE: [PATCH 02/14] mac80211: adding 802.11n definitions inieee80211.h


> >> +struct ieee80211_ht_addt_info {
>
> That's shortening for "HT additional info" which refers to 802.11n draft
> section 7.3.2.53 "HT Information element".
>
> The problem with this name results from terms confusion (IMHO) in the
> draft.
> Section 7.3.2.52 defines both "HT capabilities element" and "HT
> Information element", but both are sent during association/beaconing, so
> one may regard both as "information elements" (in classic IE way of
> looking at them).
>
> So currently ieee80211_ht_cap relates to "HT capabilities element" and
> ieee80211_ht_addt_info relates to "HT Information element"
> If anyone can think of a better naming convention to avoid confusion -
> will be most appreciated.

Not right now, and I don't have access to a recent draft anyway. But
thanks for the explanation.

johannes


Attachments:
signature.asc (828.00 B)
This is a digitally signed message part

2007-11-12 16:34:29

by Johannes Berg

[permalink] [raw]
Subject: RE: [PATCH 12/14] iwlwifi: 802.11n comply HT add station flow withmac80211 framework


> Oops sorry, I have already took this remark out, it was just a reminder
> for
> me to ask you if you think that mac80211 should give the low-level
> driver some kind of query option to its station table? It may save
> double book keeping of station table to low-level driver?

Does the driver actually need to do bookkeeping? I don't see why that
would be necessary if the ucode does it. If the driver will actually
need to do bookkeeping then I'm all for adding an iterator for the STAs
in the style of the virtual interface iterator I just added. But I
wouldn't want to add it if the driver doesn't need to do any bookkeeping
(other than maybe the number of stations) anyway.

johannes


Attachments:
signature.asc (828.00 B)
This is a digitally signed message part

2007-11-09 08:02:20

by Ron Rindjunsky

[permalink] [raw]
Subject: [PATCH 03/14] mac80211: adding 802.11n HT framework definitions

New structures:
- ieee80211_ht_info: describing STA's HT capabilities
- ieee80211_ht_bss_info: describing BSS's HT characteristics
Changed structures:
- ieee80211_hw_mode: now also holds PHY HT capabilities for each HW mode
- ieee80211_conf: ht_conf holds current self HT configuration
ht_bss_conf holds current BSS HT configuration
- flag IEEE80211_CONF_SUPPORT_HT_MODE added to indicate if HT use is
desired
- sta_info: now also holds Peer's HT capabilities

Signed-off-by: Ron Rindjunsky <[email protected]>
---
include/net/mac80211.h | 61 +++++++++++++++++++++++++++++++++++++++++++---
net/mac80211/sta_info.h | 5 ++++
2 files changed, 62 insertions(+), 4 deletions(-)

Index: wl2_6_24_HT/include/net/mac80211.h
===================================================================
--- wl2_6_24_HT.orig/include/net/mac80211.h
+++ wl2_6_24_HT/include/net/mac80211.h
@@ -138,18 +138,59 @@ enum ieee80211_phymode {
NUM_IEEE80211_MODES
};

+#ifdef CONFIG_MAC80211_HT
+
+/**
+ * struct ieee80211_ht_info - describing STA's HT capabilities
+ *
+ * This structure describes most essential parameters needed
+ * to describe 802.11n HT capabilities for an STA.
+ *
+ * @ht_supported: is HT supported by STA, 0: no, 1: yes
+ * @cap: HT capabilities map as described in 802.11n spec
+ * @ampdu_factor: Maximum A-MPDU length factor
+ * @ampdu_density: Minimum A-MPDU spacing
+ * @supp_mcs_set: Supported MCS set as described in 802.11n spec
+ */
+struct ieee80211_ht_info {
+ u8 ht_supported;
+ u16 cap; /* use IEEE80211_HT_CAP_ */
+ u8 ampdu_factor;
+ u8 ampdu_density;
+ u8 supp_mcs_set[16];
+};
+
+/**
+ * struct ieee80211_ht_bss_info - describing BSS's HT characteristics
+ *
+ * This structure describes most essential parameters needed
+ * to describe 802.11n HT characteristics in a BSS
+ *
+ * @primary_channel: channel number of primery channel
+ * @bss_cap: 802.11n's general BSS capabilities (e.g. channel width)
+ * @bss_op_mode: 802.11n's BSS operation modes (e.g. HT protection)
+ */
+struct ieee80211_ht_bss_info {
+ u8 primary_channel;
+ u8 bss_cap; /* use IEEE80211_HT_IE_CHA_ */
+ u8 bss_op_mode; /* use IEEE80211_HT_IE_ */
+};
+
+#endif /* CONFIG_MAC80211_HT */
+
/**
* struct ieee80211_hw_mode - PHY mode definition
*
* This structure describes the capabilities supported by the device
* in a single PHY mode.
*
+ * @list: internal
+ * @channels: pointer to array of supported channels
+ * @rates: pointer to array of supported bitrates
* @mode: the PHY mode for this definition
* @num_channels: number of supported channels
- * @channels: pointer to array of supported channels
* @num_rates: number of supported bitrates
- * @rates: pointer to array of supported bitrates
- * @list: internal
+ * @ht_info: PHY's 802.11n HT abilities for this mode
*/
struct ieee80211_hw_mode {
struct list_head list;
@@ -158,6 +199,9 @@ struct ieee80211_hw_mode {
enum ieee80211_phymode mode;
int num_channels;
int num_rates;
+#ifdef CONFIG_MAC80211_HT
+ struct ieee80211_ht_info ht_info;
+#endif /* CONFIG_MAC80211_HT */
};

/**
@@ -406,11 +450,14 @@ struct ieee80211_tx_status {
*
* @IEEE80211_CONF_SHORT_SLOT_TIME: use 802.11g short slot time
* @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported)
- *
+ * @IEEE80211_CONF_SUPPORT_HT_MODE: use 802.11n HT capabilities (if supported)
*/
enum ieee80211_conf_flags {
IEEE80211_CONF_SHORT_SLOT_TIME = 1<<0,
IEEE80211_CONF_RADIOTAP = 1<<1,
+#ifdef CONFIG_MAC80211_HT
+ IEEE80211_CONF_SUPPORT_HT_MODE = 1<<2,
+#endif /* CONFIG_MAC80211_HT */
};

/**
@@ -434,6 +481,8 @@ enum ieee80211_conf_flags {
* @antenna_sel_tx: transmit antenna selection, 0: default/diversity,
* 1/2: antenna 0/1
* @antenna_sel_rx: receive antenna selection, like @antenna_sel_tx
+ * @ht_conf: describes current self configuration of 802.11n HT capabilies
+ * @ht_bss_conf: describes current BSS configuration of 802.11n HT parameters
*/
struct ieee80211_conf {
int channel; /* IEEE 802.11 channel number */
@@ -452,6 +501,10 @@ struct ieee80211_conf {
u8 antenna_max;
u8 antenna_sel_tx;
u8 antenna_sel_rx;
+#ifdef CONFIG_MAC80211_HT
+ struct ieee80211_ht_info ht_conf;
+ struct ieee80211_ht_bss_info ht_bss_conf;
+#endif /* CONFIG_MAC80211_HT */
};

/**
Index: wl2_6_24_HT/net/mac80211/sta_info.h
===================================================================
--- wl2_6_24_HT.orig/net/mac80211/sta_info.h
+++ wl2_6_24_HT/net/mac80211/sta_info.h
@@ -99,6 +99,11 @@ struct sta_info {

u16 listen_interval;

+#ifdef CONFIG_MAC80211_HT
+ struct ieee80211_ht_info ht_info; /* 802.11n HT capabilities
+ of this STA */
+#endif /* CONFIG_MAC80211_HT */
+
#ifdef CONFIG_MAC80211_DEBUGFS
struct sta_info_debugfsdentries {
struct dentry *dir;
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2007-11-09 08:02:19

by Ron Rindjunsky

[permalink] [raw]
Subject: [PATCH 12/14] iwlwifi: 802.11n comply HT add station flow with mac80211 framework

This patch conforms the addition of a new station to the iwlwifi station
table according to the new mac80211's HT framework

Signed-off-by: Ron Rindjunsky <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-4965-rs.c | 8 +++---
drivers/net/wireless/iwlwifi/iwl-4965.c | 28 ++++++++++----------------
drivers/net/wireless/iwlwifi/iwl-4965.h | 8 +++---
drivers/net/wireless/iwlwifi/iwl4965-base.c | 25 ++++++++++++++++++++---
4 files changed, 40 insertions(+), 29 deletions(-)

Index: wl2_6_24_HT/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
===================================================================
--- wl2_6_24_HT.orig/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
+++ wl2_6_24_HT/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
@@ -1725,8 +1725,8 @@ static struct ieee80211_rate *rs_get_rat
if (sta_id == IWL_INVALID_STATION) {
IWL_DEBUG_RATE("LQ: ADD station %s\n",
print_mac(mac, hdr->addr1));
- sta_id = iwl_add_station(priv,
- hdr->addr1, 0, CMD_ASYNC);
+ sta_id = iwl_add_station(priv, hdr->addr1,
+ 0, CMD_ASYNC, NULL);
}
if ((sta_id != IWL_INVALID_STATION)) {
lq->lq.sta_id = sta_id;
@@ -1801,8 +1801,8 @@ static void rs_rate_init(void *priv_rate
if (sta_id == IWL_INVALID_STATION) {
IWL_DEBUG_RATE("LQ: ADD station %s\n",
print_mac(mac, sta->addr));
- sta_id = iwl_add_station(priv,
- sta->addr, 0, CMD_ASYNC);
+ sta_id = iwl_add_station(priv, sta->addr,
+ 0, CMD_ASYNC, NULL);
}
if ((sta_id != IWL_INVALID_STATION)) {
crl->lq.sta_id = sta_id;
Index: wl2_6_24_HT/drivers/net/wireless/iwlwifi/iwl-4965.c
===================================================================
--- wl2_6_24_HT.orig/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ wl2_6_24_HT/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -4444,39 +4444,33 @@ void iwl4965_set_rxon_ht(struct iwl_priv
return;
}

-void iwl4965_set_ht_add_station(struct iwl_priv *priv, u8 index)
+void iwl4965_set_ht_add_station(struct iwl_priv *priv, u8 index,
+ struct ieee80211_ht_info *sta_ht_inf)
{
__le32 sta_flags;
- struct sta_ht_info *ht_info = &priv->current_assoc_ht;

- priv->current_channel_width = IWL_CHANNEL_WIDTH_20MHZ;
- if (!ht_info->is_ht)
+ if (!sta_ht_inf || !sta_ht_inf->ht_supported)
goto done;

sta_flags = priv->stations[index].sta.station_flags;

- if (ht_info->tx_mimo_ps_mode == IWL_MIMO_PS_DYNAMIC)
+ if (((sta_ht_inf->cap & IEEE80211_HT_CAP_MIMO_PS >> 2))
+ == IWL_MIMO_PS_DYNAMIC)
sta_flags |= STA_FLG_RTS_MIMO_PROT_MSK;
else
sta_flags &= ~STA_FLG_RTS_MIMO_PROT_MSK;

sta_flags |= cpu_to_le32(
- (u32)ht_info->ampdu_factor << STA_FLG_MAX_AGG_SIZE_POS);
+ (u32)sta_ht_inf->ampdu_factor << STA_FLG_MAX_AGG_SIZE_POS);

sta_flags |= cpu_to_le32(
- (u32)ht_info->mpdu_density << STA_FLG_AGG_MPDU_DENSITY_POS);
+ (u32)sta_ht_inf->ampdu_density << STA_FLG_AGG_MPDU_DENSITY_POS);

- sta_flags &= (~STA_FLG_FAT_EN_MSK);
- ht_info->tx_chan_width = IWL_CHANNEL_WIDTH_20MHZ;
- ht_info->chan_width_cap = IWL_CHANNEL_WIDTH_20MHZ;
-
- if (iwl_is_fat_tx_allowed(priv, ht_info)) {
+ if (iwl_is_fat_tx_allowed(priv, sta_ht_inf))
sta_flags |= STA_FLG_FAT_EN_MSK;
- ht_info->chan_width_cap = IWL_CHANNEL_WIDTH_40MHZ;
- if (ht_info->supported_chan_width == IWL_CHANNEL_WIDTH_40MHZ)
- ht_info->tx_chan_width = IWL_CHANNEL_WIDTH_40MHZ;
- }
- priv->current_channel_width = ht_info->tx_chan_width;
+ else
+ sta_flags &= (~STA_FLG_FAT_EN_MSK);
+
priv->stations[index].sta.station_flags = sta_flags;
done:
return;
Index: wl2_6_24_HT/drivers/net/wireless/iwlwifi/iwl-4965.h
===================================================================
--- wl2_6_24_HT.orig/drivers/net/wireless/iwlwifi/iwl-4965.h
+++ wl2_6_24_HT/drivers/net/wireless/iwlwifi/iwl-4965.h
@@ -612,8 +612,8 @@ struct iwl_driver_hw_info {
struct iwl_addsta_cmd;
extern int iwl_send_add_station(struct iwl_priv *priv,
struct iwl_addsta_cmd *sta, u8 flags);
-extern u8 iwl_add_station(struct iwl_priv *priv, const u8 *bssid,
- int is_ap, u8 flags);
+extern u8 iwl_add_station(struct iwl_priv *priv, const u8 *addr,
+ int is_ap, u8 flags, void *ht_data);
extern int iwl_is_network_packet(struct iwl_priv *priv,
struct ieee80211_hdr *header);
extern int iwl_power_init_handle(struct iwl_priv *priv);
@@ -749,8 +749,6 @@ extern int iwl4965_tx_cmd(struct iwl_pri
struct ieee80211_tx_control *ctrl, void *sta_in);
extern int iwl4965_alive_notify(struct iwl_priv *priv);
extern void iwl4965_update_rate_scaling(struct iwl_priv *priv, u8 mode);
-extern void iwl4965_set_ht_add_station(struct iwl_priv *priv, u8 index);
-
extern void iwl4965_chain_noise_reset(struct iwl_priv *priv);
extern void iwl4965_init_sensitivity(struct iwl_priv *priv, u8 flags,
u8 force);
@@ -765,6 +763,8 @@ extern void iwl4965_init_ht_hw_capab(str
int mode);
extern void iwl4965_set_rxon_ht(struct iwl_priv *priv,
struct iwl_ht_info *ht_info);
+extern void iwl4965_set_ht_add_station(struct iwl_priv *priv, u8 index,
+ struct ieee80211_ht_info *sta_ht_inf);
#ifdef CONFIG_IWL4965_HT_AGG
extern int iwl_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da,
u16 tid, u16 *start_seq_num);
Index: wl2_6_24_HT/drivers/net/wireless/iwlwifi/iwl4965-base.c
===================================================================
--- wl2_6_24_HT.orig/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ wl2_6_24_HT/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -456,7 +456,8 @@ static void iwl_clear_stations_table(str
spin_unlock_irqrestore(&priv->sta_lock, flags);
}

-u8 iwl_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap, u8 flags)
+u8 iwl_add_station(struct iwl_priv *priv, const u8 *addr,
+ int is_ap, u8 flags, void *ht_data)
{
int i;
int index = IWL_INVALID_STATION;
@@ -512,7 +513,8 @@ u8 iwl_add_station(struct iwl_priv *priv
/* BCAST station and IBSS stations do not work in HT mode */
if (index != priv->hw_setting.bcast_sta_id &&
priv->iw_mode != IEEE80211_IF_TYPE_IBSS)
- iwl4965_set_ht_add_station(priv, index);
+ iwl4965_set_ht_add_station(priv, index,
+ (struct ieee80211_ht_info *) ht_data);
#endif /*CONFIG_IWL4965_HT*/

spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
@@ -851,7 +853,22 @@ static int iwl_rxon_add_station(struct i
{
u8 sta_id;

- sta_id = iwl_add_station(priv, addr, is_ap, 0);
+ /* TODO - consider checking if mac80211 will allow
+ * to query its station table - will help here */
+#ifdef CONFIG_IWL4965_HT
+ struct ieee80211_conf *conf = &priv->hw->conf;
+ struct ieee80211_ht_info *cur_ht_config = &conf->ht_conf;
+
+ if ((is_ap) &&
+ (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) &&
+ (priv->iw_mode == IEEE80211_IF_TYPE_STA))
+ sta_id = iwl_add_station(priv, addr, is_ap,
+ 0, cur_ht_config);
+ else
+#endif /* CONFIG_IWL4965_HT */
+ sta_id = iwl_add_station(priv, addr, is_ap,
+ 0, NULL);
+
iwl4965_add_station(priv, addr, is_ap);

return sta_id;
@@ -2773,7 +2790,7 @@ static int iwl_get_sta_id(struct iwl_pri
if (sta_id != IWL_INVALID_STATION)
return sta_id;

- sta_id = iwl_add_station(priv, hdr->addr1, 0, CMD_ASYNC);
+ sta_id = iwl_add_station(priv, hdr->addr1, 0, CMD_ASYNC, NULL);

if (sta_id != IWL_INVALID_STATION)
return sta_id;
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2007-11-11 20:20:40

by Ron Rindjunsky

[permalink] [raw]
Subject: RE: [PATCH 05/14] mac80211: adding 802.11n essential A-MPDU addBAcapability


>> As this series of patches only adds HT handling with no aggregations,
>> (A-MPDU aggregations acceptance is not obligatory according to
802.11n draft)
>> we are currently sending back a refusal upon this request.

> Heh. In the Kconfig you just wrote that it handles AMPDU and AMSDU
> aggregation which I'd expect to imply deaggregation too. Nothing
> serious, just seemed a bit weird! :)
> And isn't one of the two (I always forget which one) rather a feature
of
> the hardware?

Well, aggregation handling is the next step if these patches are
acceptable... :)

You are right, A-MPDU is really in the bottom of the data plane
architecture, so in most cases _creating_ it will be an HW feature,
while A-MSDU should be implemented in a much higher level place in the
flow.
Two reasons why I placed A-MPDU handling in the mac80211:
- A-MPDU demands a "session" level management (add BACK, del BACK, BAR),
which looks to me more mac80211 oriented
- A-MPDU extends the "Access Category" of 11e into "Traffic Identifier"
(TID) to give finer granularity of frames priority. As mac80211 already
handles prioritization in wme.c, it looked like a good starting point.

>> +#ifdef CONFIG_MAC80211_HT
>> +/* mgmt header + 1 byte action code */
>> +#define IEEE80211_MIN_ACTION_SIZE (24 + 1)
>> +
>> +#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
>> +#define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C
>> +#define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0
>> +#endif /* CONFIG_MAC80211_HT */

> Leave out the ifdefs please when they only protect definitions or
such,
> i.e. nothing that will generate code/allocate structure space.

Will be removed

>> + capab |= (u16)(buf_size << 6); /* bit 15:6 max size of
aggergation */

> typo: aggregation. Interesting what an email program with a spell
> checker makes you notice :) (No, I'm not suggesting you run a spell
> checker, I'm rather saying that I probably wouldn't have noticed
> otherwise)

Thanks :), will fix. Makes me wonder if i better use firefox as my
editor :)

>> +static void ieee80211_sta_process_addba_request(struct net_device
*dev,


>> + /* TODO - add here aggregation support */

> I think that comment is misleading. We don't add aggregation support
> here but rather when adding it we must change this code, but anyway.
> Don't bother.

I can remove that, just a reference for development convenience.

>> + printk(KERN_DEBUG "%s: received unsupported
BACK\n",
>> + dev->name);

> net_ratelimit() please, otherwise people can flood our logs by just
> sending us strange frames.

Perfectly right, will add net_ratelimit.

> Btw. I'd like to remove code from ieee80211_sta.c rather than add this
> much. Do you see any way to partition your code differently? The
> ieee80211_sta.c file is a huge file and barely understandable when you
> just read it... I was at one time working on extracting the scan code
> out from it and keep only MLME stuff in there. My goal was to be able
to

As mentioned above - one can treat A-MPDU session as a kind of MLME, so
this is a rather interesting point. Currently I'll keep the code there,
and if you see it burdens ieee80211_sta.c just tell me.

> not compile ieee80211_sta.c unless the user wanted the in-kernel MLME,
> but maybe I should rather put the MLME into a new file then. I'd
> appreciate if you could give it (partitioning the code otherwise) a
> thought, but I promise I won't be disappointed if you don't want to do
> it.

> johannes
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2007-11-09 08:02:19

by Ron Rindjunsky

[permalink] [raw]
Subject: [PATCH 14/14] iwlwifi: 802.11n add support to 8K A-MSDU Rx frames

This patch give the iwlwifi the ability to support A-MSDU up to 8K

Please notice - in order to work in 8K A-MSDU ucode support is needed,
version 4.44.1.19 (soon to be published). 4K A-MSDU works in current ucode
version as well.

Signed-off-by: Ron Rindjunsky <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-3945-hw.h | 1 -
drivers/net/wireless/iwlwifi/iwl-3945.c | 3 ++-
drivers/net/wireless/iwlwifi/iwl-3945.h | 5 +++--
drivers/net/wireless/iwlwifi/iwl-4965-hw.h | 14 +++++++++-----
drivers/net/wireless/iwlwifi/iwl-4965.c | 20 +++++++++++++++++---
drivers/net/wireless/iwlwifi/iwl-4965.h | 5 +++--
drivers/net/wireless/iwlwifi/iwl4965-base.c | 21 ++++++++++++++-------
7 files changed, 48 insertions(+), 21 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h
index 0a5a08d..fb362ff 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h
@@ -691,7 +691,6 @@ struct iwl_eeprom {
#define RX_LOW_WATERMARK 8


-#define IWL_RX_BUF_SIZE 3000
/* card static random access memory (SRAM) for processor data and instructs */
#define ALM_RTC_INST_UPPER_BOUND (0x014000)
#define ALM_RTC_DATA_UPPER_BOUND (0x808000)
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index e9cb40e..4cd0ed8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -2197,7 +2197,8 @@ int iwl_hw_set_hw_setting(struct iwl_priv *priv)
}

priv->hw_setting.ac_queue_count = AC_NUM;
- priv->hw_setting.rx_buffer_size = IWL_RX_BUF_SIZE;
+ priv->hw_setting.rx_buf_size = IWL_RX_BUF_SIZE;
+ priv->hw_setting.max_pkt_size = 2342;
priv->hw_setting.tx_cmd_len = sizeof(struct iwl_tx_cmd);
priv->hw_setting.max_rxq_size = RX_QUEUE_SIZE;
priv->hw_setting.max_rxq_log = RX_QUEUE_SIZE_LOG;
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index d1616bf..a5332ac 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -72,6 +72,7 @@ enum iwl_antenna {
* else RTS for data/management frames where MPDU is larger
* than RTS value.
*/
+#define IWL_RX_BUF_SIZE 3000U
#define DEFAULT_RTS_THRESHOLD 2347U
#define MIN_RTS_THRESHOLD 0U
#define MAX_RTS_THRESHOLD 2347U
@@ -447,7 +448,6 @@ union iwl_ht_rate_supp {

#ifdef CONFIG_IWL3945_HT
#define CFG_HT_RX_AMPDU_FACTOR_DEF (0x3)
-#define HT_IE_MAX_AMSDU_SIZE_4K (0)
#define CFG_HT_MPDU_DENSITY_2USEC (0x5)
#define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_2USEC

@@ -552,7 +552,8 @@ struct iwl_driver_hw_info {
u16 ac_queue_count;
u16 tx_cmd_len;
u16 max_rxq_size;
- u32 rx_buffer_size;
+ u32 rx_buf_size;
+ u32 max_pkt_size;
u16 max_rxq_log;
u8 max_stations;
u8 bcast_sta_id;
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h
index 21c7577..61b57ac 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h
@@ -740,8 +740,8 @@ struct iwl_eeprom {
#define RX_FREE_BUFFERS 64
#define RX_LOW_WATERMARK 8

-
-#define IWL_RX_BUF_SIZE (4 * 1024)
+#define IWL_RX_BUF_SIZE_4K (4 * 1024)
+#define IWL_RX_BUF_SIZE_8K (8 * 1024)
#define IWL_MAX_BSM_SIZE BSM_SRAM_SIZE
#define KDR_RTC_INST_UPPER_BOUND (0x018000)
#define KDR_RTC_DATA_UPPER_BOUND (0x80A000)
@@ -1055,15 +1055,19 @@ union iwl_tx_power_dual_stream {
#define FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_MASK (0x00001000) /* bit 12 */
#define FH_RCSR_CHNL0_RX_CONFIG_RB_TIMEOUT_MASK (0x00000FF0) /* bit 4-11 */

-#define FH_RCSR_RX_CONFIG_RBDCB_SIZE_BITSHIFT (20)
-#define FH_RCSR_RX_CONFIG_RB_SIZE_BITSHIFT (16)
+#define FH_RCSR_RX_CONFIG_RBDCB_SIZE_BITSHIFT (20)
+#define FH_RCSR_RX_CONFIG_REG_IRQ_RBTH_BITSHIFT (4)
+#define RX_RB_TIMEOUT (0x10)

/* RCSR: rx_config register values */
#define FH_RCSR_RX_CONFIG_CHNL_EN_PAUSE_VAL (0x00000000)
#define FH_RCSR_RX_CONFIG_CHNL_EN_PAUSE_EOF_VAL (0x40000000)
#define FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL (0x80000000)

-#define IWL_FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K (0x00000000)
+#define FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K (0x00000000)
+#define FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_8K (0x00010000)
+#define FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_12K (0x00020000)
+#define FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_16K (0x00030000)

/* RCSR channel 0 config register values */
#define FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_NO_INT_VAL (0x00000000)
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 91fbf3d..ca61117 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -226,6 +226,7 @@ static int iwl4965_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
{
int rc;
unsigned long flags;
+ unsigned int rb_size;

spin_lock_irqsave(&priv->lock, flags);
rc = iwl_grab_nic_access(priv);
@@ -234,6 +235,11 @@ static int iwl4965_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
return rc;
}

+ if (iwl_param_amsdu_size_8K)
+ rb_size = FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_8K;
+ else
+ rb_size = FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K;
+
/* stop HW */
iwl_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0);

@@ -248,7 +254,7 @@ static int iwl4965_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
iwl_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG,
FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL |
FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL |
- IWL_FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K |
+ rb_size |
/*0x10 << 4 | */
(RX_QUEUE_SIZE_LOG <<
FH_RCSR_RX_CONFIG_RBDCB_SIZE_BITSHIFT));
@@ -1721,7 +1727,11 @@ int iwl_hw_set_hw_setting(struct iwl_priv *priv)
priv->hw_setting.tx_cmd_len = sizeof(struct iwl_tx_cmd);
priv->hw_setting.max_rxq_size = RX_QUEUE_SIZE;
priv->hw_setting.max_rxq_log = RX_QUEUE_SIZE_LOG;
-
+ if (iwl_param_amsdu_size_8K)
+ priv->hw_setting.rx_buf_size = IWL_RX_BUF_SIZE_8K;
+ else
+ priv->hw_setting.rx_buf_size = IWL_RX_BUF_SIZE_4K;
+ priv->hw_setting.max_pkt_size = priv->hw_setting.rx_buf_size - 256;
priv->hw_setting.max_stations = IWL4965_STATION_COUNT;
priv->hw_setting.bcast_sta_id = IWL4965_BROADCAST_ID;
return 0;
@@ -3519,7 +3529,7 @@ static void iwl4965_handle_data_packet(struct iwl_priv *priv, int is_data,
rx_start->byte_count = amsdu->byte_count;
rx_end = (__le32 *) (((u8 *) hdr) + len);
}
- if (len > IWL_RX_BUF_SIZE || len < 16) {
+ if (len > priv->hw_setting.max_pkt_size || len < 16) {
IWL_WARNING("byte count out of range [16,4K]"
" : %d\n", len);
return;
@@ -3685,6 +3695,10 @@ void iwl4965_init_ht_hw_capab(struct ieee80211_ht_info *ht_info, int mode)
ht_info->cap |= (u16)IEEE80211_HT_CAP_SGI_20;
ht_info->cap |= (u16)(IEEE80211_HT_CAP_MIMO_PS &
(IWL_MIMO_PS_NONE << 2));
+ if (iwl_param_amsdu_size_8K) {
+ printk(KERN_DEBUG "iwl4965 in A-MSDU 8K support mode\n");
+ ht_info->cap |= (u16)IEEE80211_HT_CAP_MAX_AMSDU;
+ }

ht_info->ampdu_factor = CFG_HT_RX_AMPDU_FACTOR_DEF;
ht_info->ampdu_density = CFG_HT_MPDU_DENSITY_DEF;
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h
index 3494fc5..2ac9173 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.h
@@ -56,6 +56,7 @@ extern struct pci_device_id iwl_hw_card_ids[];
/* Module parameters accessible from iwl-*.c */
extern int iwl_param_hwcrypto;
extern int iwl_param_queues_num;
+extern int iwl_param_amsdu_size_8K;

enum iwl_antenna {
IWL_ANTENNA_DIVERSITY,
@@ -473,7 +474,6 @@ union iwl_ht_rate_supp {

#ifdef CONFIG_IWL4965_HT
#define CFG_HT_RX_AMPDU_FACTOR_DEF (0x3)
-#define HT_IE_MAX_AMSDU_SIZE_4K (0)
#define CFG_HT_MPDU_DENSITY_2USEC (0x5)
#define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_2USEC

@@ -572,7 +572,8 @@ struct iwl_driver_hw_info {
u16 ac_queue_count;
u16 tx_cmd_len;
u16 max_rxq_size;
- u32 rx_buffer_size;
+ u32 rx_buf_size;
+ u32 max_pkt_size;
u16 max_rxq_log;
u8 max_stations;
u8 bcast_sta_id;
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 95374f4..3bd030d 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -81,6 +81,7 @@ static int iwl_param_antenna; /* def: 0 = both antennas (use diversity) */
int iwl_param_hwcrypto; /* def: using software encryption */
static int iwl_param_qos_enable = 1;
int iwl_param_queues_num = IWL_MAX_NUM_QUEUES;
+int iwl_param_amsdu_size_8K; /* def: enable 8K amsdu size */

/*
* module name, copyright, version, etc.
@@ -3166,7 +3167,7 @@ void iwl_handle_data_packet_monitor(struct iwl_priv *priv,
__le16 phy_flags_hw = cpu_to_le16(phy_flags);

/* We received data from the HW, so stop the watchdog */
- if (len > IWL_RX_BUF_SIZE - sizeof(*iwl_rt)) {
+ if (len > priv->hw_setting.rx_buf_size - sizeof(*iwl_rt)) {
IWL_DEBUG_DROP("Dropping too large packet in monitor\n");
return;
}
@@ -4395,7 +4396,8 @@ void iwl_rx_replenish(void *data)
element = rxq->rx_used.next;
rxb = list_entry(element, struct iwl_rx_mem_buffer, list);
rxb->skb =
- alloc_skb(IWL_RX_BUF_SIZE, __GFP_NOWARN | GFP_ATOMIC);
+ alloc_skb(priv->hw_setting.rx_buf_size,
+ __GFP_NOWARN | GFP_ATOMIC);
if (!rxb->skb) {
if (net_ratelimit())
printk(KERN_CRIT DRV_NAME
@@ -4409,7 +4411,7 @@ void iwl_rx_replenish(void *data)
list_del(element);
rxb->dma_addr =
pci_map_single(priv->pci_dev, rxb->skb->data,
- IWL_RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
+ priv->hw_setting.rx_buf_size, PCI_DMA_FROMDEVICE);
list_add_tail(&rxb->list, &rxq->rx_free);
rxq->free_count++;
}
@@ -4432,7 +4434,8 @@ static void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
if (rxq->pool[i].skb != NULL) {
pci_unmap_single(priv->pci_dev,
rxq->pool[i].dma_addr,
- IWL_RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
+ priv->hw_setting.rx_buf_size,
+ PCI_DMA_FROMDEVICE);
dev_kfree_skb(rxq->pool[i].skb);
}
}
@@ -4479,7 +4482,8 @@ void iwl_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
if (rxq->pool[i].skb != NULL) {
pci_unmap_single(priv->pci_dev,
rxq->pool[i].dma_addr,
- IWL_RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
+ priv->hw_setting.rx_buf_size,
+ PCI_DMA_FROMDEVICE);
priv->alloc_rxb_skb--;
dev_kfree_skb(rxq->pool[i].skb);
rxq->pool[i].skb = NULL;
@@ -4606,7 +4610,7 @@ static void iwl_rx_handle(struct iwl_priv *priv)
rxq->queue[i] = NULL;

pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->dma_addr,
- IWL_RX_BUF_SIZE,
+ priv->hw_setting.rx_buf_size,
PCI_DMA_FROMDEVICE);
pkt = (struct iwl_rx_packet *)rxb->skb->data;

@@ -4659,7 +4663,8 @@ static void iwl_rx_handle(struct iwl_priv *priv)
}

pci_unmap_single(priv->pci_dev, rxb->dma_addr,
- IWL_RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
+ priv->hw_setting.rx_buf_size,
+ PCI_DMA_FROMDEVICE);
spin_lock_irqsave(&rxq->lock, flags);
list_add_tail(&rxb->list, &priv->rxq.rx_used);
spin_unlock_irqrestore(&rxq->lock, flags);
@@ -9302,6 +9307,8 @@ MODULE_PARM_DESC(queues_num, "number of hw queues.");
/* QoS */
module_param_named(qos_enable, iwl_param_qos_enable, int, 0444);
MODULE_PARM_DESC(qos_enable, "enable all QoS functionality");
+module_param_named(amsdu_size_8K, iwl_param_amsdu_size_8K, int, 0444);
+MODULE_PARM_DESC(amsdu_size_8K, "enable 8K amsdu size");

module_exit(iwl_exit);
module_init(iwl_init);
--
1.5.3.3
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2007-11-13 16:10:21

by Ron Rindjunsky

[permalink] [raw]
Subject: RE: [PATCH 06/14] mac80211: adding 802.11n essential A-MSDURxcapability


>> I agree. Good point and thanks for the catch.
>> Would appreciate your opinion for next possible solution:
>> I'll Move ieee80211_rx_h_data_agg before ieee80211_rx_h_802_1x_pae,
and
>> assuming I identify A-MSDU, I'll loop for each internal MSDU on:
>> ieee80211_rx_h_802_1x_pae
>> ieee80211_rx_h_drop_unencrypted
>> ieee80211_rx_h_data
>> return value of ieee80211_rx_h_data_agg to
>> __ieee80211_invoke_rx_handlers will be this small loop's return value


> I'm not sure I'd like to see such a thing. One thing I'm generally
> unhappy with here is how the handlers are in a list but there isn't a
> point in adding/removing any. Also, I'm not convinced that what you're
> saying will actually work because the handlers expect 802.11 frames so
> you'd have to make 802.11 frames out of the 802.3 frames you get...

True, it is a drawback, as I'll have to create 802.11 frames instead of
802.3 (with important data duplicated into all of them), but then I'll
just call ieee80211_invoke_rx_handlers with ieee80211_rx_handler
pointed to
local->rx_handlers[ieee80211_rx_h_802_1x_pae]. Then I won't have to
change any existing handler except of my new ieee80211_rx_h_amsdu
Do you think this approach makes sense?

> What I originally wanted to do for this was to add a new
> "handle_data_frame" function that operates on 802.3 frames but has all
> the info available, is called from the rx_h_data handler and

> incorporates all the three callbacks you list above.That'd be similar
to
> what I did with the crypto code (where we now only have a single
handler

Do you mean ieee80211_rx_h_decrypt?
If yes, I see it uses 3 different decrypt schemes. Here I have one
scheme reaping it self over and over.

> doing it all rather than a bunch doing different pieces of the
> functionality)
>
> It'd basically look like this
>
> handle_data_frame
> {
> result = handle_pae()
> if (result == ...)
>
> if (should_drop_unencrypted && is_unencrypted())
> return DROP
>
> ...
> }
>
> and rx_h_data would simply reframe the frame and pass it to this
> function, and your deaggregation handler would loop over this
function.
>
> You should be able to do this in the code right now because I removed
> the management interface and hence EAPOL frames aren't handled
> specially. Hostapd wants to have eapol frames on the management
> interface and 802.11 framed, but I don't understand that and would
> rather have it be done differently.
>
> We may need more discussion, but I believe finding a good solution to
> this is a crucial part of proper support for deaggregation.

> johannes
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2007-11-12 16:44:23

by Johannes Berg

[permalink] [raw]
Subject: RE: [PATCH 06/14] mac80211: adding 802.11n essential A-MSDU Rxcapability


> > The one thing I'm not sure about here is the EAPOL frame handling. In
> > theory, such frames could be part of an aggregation and thus we'll not
> > get them to the right place. Then again, we haven't decided yet what
> the
> > right place is. Also, what happens with 802.1X port control?
>
> I agree. Good point and thanks for the catch.
> Would appreciate your opinion for next possible solution:
> I'll Move ieee80211_rx_h_data_agg before ieee80211_rx_h_802_1x_pae, and
> assuming I identify A-MSDU, I'll loop for each internal MSDU on:
> ieee80211_rx_h_802_1x_pae
> ieee80211_rx_h_drop_unencrypted
> ieee80211_rx_h_data
> return value of ieee80211_rx_h_data_agg to
> __ieee80211_invoke_rx_handlers will be this small loop's return value

I'm not sure I'd like to see such a thing. One thing I'm generally
unhappy with here is how the handlers are in a list but there isn't a
point in adding/removing any. Also, I'm not convinced that what you're
saying will actually work because the handlers expect 802.11 frames so
you'd have to make 802.11 frames out of the 802.3 frames you get...

What I originally wanted to do for this was to add a new
"handle_data_frame" function that operates on 802.3 frames but has all
the info available, is called from the rx_h_data handler and
incorporates all the three callbacks you list above.That'd be similar to
what I did with the crypto code (where we now only have a single handler
doing it all rather than a bunch doing different pieces of the
functionality)

It'd basically look like this

handle_data_frame
{
result = handle_pae()
if (result == ...)

if (should_drop_unencrypted && is_unencrypted())
return DROP

...
}

and rx_h_data would simply reframe the frame and pass it to this
function, and your deaggregation handler would loop over this function.

You should be able to do this in the code right now because I removed
the management interface and hence EAPOL frames aren't handled
specially. Hostapd wants to have eapol frames on the management
interface and 802.11 framed, but I don't understand that and would
rather have it be done differently.

We may need more discussion, but I believe finding a good solution to
this is a crucial part of proper support for deaggregation.

johannes


Attachments:
signature.asc (828.00 B)
This is a digitally signed message part

2007-11-12 03:24:35

by Michael Wu

[permalink] [raw]
Subject: Re: [PATCH 01/14] mac80211: adding MAC80211_HT config variable

On Friday 09 November 2007 03:01:53 Ron Rindjunsky wrote:
> This patch adds MAC80211_HT and MAC80211_HT_DEBUG config variables
> to separate HT features
>
Nah. We don't need more ifdefs. Just leave the code on all the time. The
overhead when it's not being used should be minimal and if it's not.. that
needs to be fixed anyway.

Also there doesn't appear to be MAC80211_HT_DEBUG in this patch, though I'd be
okay with that.

-Michael Wu


Attachments:
(No filename) (441.00 B)
signature.asc (194.00 B)
This is a digitally signed message part.
Download all attachments

2007-11-09 08:02:17

by Ron Rindjunsky

[permalink] [raw]
Subject: [PATCH 13/14] iwlwifi: 802.11n comply HT rate scaling flows with mac80211 framework

This patch conforms the rate scaling flows according to the new mac80211's
HT framework

Signed-off-by: Ron Rindjunsky <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-4965-rs.c | 93 +++++++++++++++++-----------
1 files changed, 57 insertions(+), 36 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
index 9b213a1..cdaf45a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
@@ -440,15 +440,14 @@ static inline void rs_toggle_antenna(struct iwl_rate *new_rate,
}
}

-static inline u8 rs_use_green(struct iwl_priv *priv)
+static inline u8 rs_use_green(struct iwl_priv *priv,
+ struct ieee80211_conf *conf)
{
#ifdef CONFIG_IWL4965_HT
- if (!priv->is_ht_enabled || !priv->current_assoc_ht.is_ht)
- return 0;
-
- return ((priv->current_assoc_ht.is_green_field) &&
- !(priv->current_assoc_ht.operating_mode & 0x4));
-#endif /*CONFIG_IWL4965_HT */
+ return ((conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) &&
+ priv->current_ht_config.is_green_field &&
+ !priv->current_ht_config.non_GF_STA_present);
+#endif /* CONFIG_IWL4965_HT */
return 0;
}

@@ -888,6 +887,8 @@ static inline u8 rs_is_both_ant_supp(u8 valid_antenna)

static int rs_switch_to_mimo(struct iwl_priv *priv,
struct iwl_rate_scale_priv *lq_data,
+ struct ieee80211_conf *conf,
+ struct sta_info *sta,
struct iwl_scale_tbl_info *tbl, int index)
{
#ifdef CONFIG_IWL4965_HT
@@ -895,7 +896,8 @@ static int rs_switch_to_mimo(struct iwl_priv *priv,
s32 rate;
s8 is_green = lq_data->is_green;

- if (!priv->is_ht_enabled || !priv->current_assoc_ht.is_ht)
+ if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) ||
+ !sta->ht_info.ht_supported)
return -1;

IWL_DEBUG_HT("LQ: try to switch to MIMO\n");
@@ -903,7 +905,7 @@ static int rs_switch_to_mimo(struct iwl_priv *priv,
rs_get_supported_rates(lq_data, NULL, tbl->lq_type,
&rate_mask);

- if (priv->current_assoc_ht.tx_mimo_ps_mode == IWL_MIMO_PS_STATIC)
+ if (priv->current_ht_config.tx_mimo_ps_mode == IWL_MIMO_PS_STATIC)
return -1;

if (!rs_is_both_ant_supp(lq_data->antenna))
@@ -911,17 +913,18 @@ static int rs_switch_to_mimo(struct iwl_priv *priv,

tbl->is_dup = lq_data->is_dup;
tbl->action = 0;
- if (priv->current_channel_width == IWL_CHANNEL_WIDTH_40MHZ)
+ if (priv->current_ht_config.supported_chan_width
+ == IWL_CHANNEL_WIDTH_40MHZ)
tbl->is_fat = 1;
else
tbl->is_fat = 0;

if (tbl->is_fat) {
- if (priv->current_assoc_ht.sgf & HT_SHORT_GI_40MHZ_ONLY)
+ if (priv->current_ht_config.sgf & HT_SHORT_GI_40MHZ_ONLY)
tbl->is_SGI = 1;
else
tbl->is_SGI = 0;
- } else if (priv->current_assoc_ht.sgf & HT_SHORT_GI_20MHZ_ONLY)
+ } else if (priv->current_ht_config.sgf & HT_SHORT_GI_20MHZ_ONLY)
tbl->is_SGI = 1;
else
tbl->is_SGI = 0;
@@ -944,6 +947,8 @@ static int rs_switch_to_mimo(struct iwl_priv *priv,

static int rs_switch_to_siso(struct iwl_priv *priv,
struct iwl_rate_scale_priv *lq_data,
+ struct ieee80211_conf *conf,
+ struct sta_info *sta,
struct iwl_scale_tbl_info *tbl, int index)
{
#ifdef CONFIG_IWL4965_HT
@@ -952,7 +957,8 @@ static int rs_switch_to_siso(struct iwl_priv *priv,
s32 rate;

IWL_DEBUG_HT("LQ: try to switch to SISO\n");
- if (!priv->is_ht_enabled || !priv->current_assoc_ht.is_ht)
+ if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) ||
+ !sta->ht_info.ht_supported)
return -1;

tbl->is_dup = lq_data->is_dup;
@@ -961,17 +967,18 @@ static int rs_switch_to_siso(struct iwl_priv *priv,
rs_get_supported_rates(lq_data, NULL, tbl->lq_type,
&rate_mask);

- if (priv->current_channel_width == IWL_CHANNEL_WIDTH_40MHZ)
+ if (priv->current_ht_config.supported_chan_width
+ == IWL_CHANNEL_WIDTH_40MHZ)
tbl->is_fat = 1;
else
tbl->is_fat = 0;

if (tbl->is_fat) {
- if (priv->current_assoc_ht.sgf & HT_SHORT_GI_40MHZ_ONLY)
+ if (priv->current_ht_config.sgf & HT_SHORT_GI_40MHZ_ONLY)
tbl->is_SGI = 1;
else
tbl->is_SGI = 0;
- } else if (priv->current_assoc_ht.sgf & HT_SHORT_GI_20MHZ_ONLY)
+ } else if (priv->current_ht_config.sgf & HT_SHORT_GI_20MHZ_ONLY)
tbl->is_SGI = 1;
else
tbl->is_SGI = 0;
@@ -998,6 +1005,8 @@ static int rs_switch_to_siso(struct iwl_priv *priv,

static int rs_move_legacy_other(struct iwl_priv *priv,
struct iwl_rate_scale_priv *lq_data,
+ struct ieee80211_conf *conf,
+ struct sta_info *sta,
int index)
{
int ret = 0;
@@ -1037,8 +1046,8 @@ static int rs_move_legacy_other(struct iwl_priv *priv,
search_tbl->lq_type = LQ_SISO;
search_tbl->is_SGI = 0;
search_tbl->is_fat = 0;
- ret = rs_switch_to_siso(priv, lq_data, search_tbl,
- index);
+ ret = rs_switch_to_siso(priv, lq_data, conf, sta,
+ search_tbl, index);
if (!ret) {
lq_data->search_better_tbl = 1;
lq_data->action_counter = 0;
@@ -1053,8 +1062,8 @@ static int rs_move_legacy_other(struct iwl_priv *priv,
search_tbl->is_SGI = 0;
search_tbl->is_fat = 0;
search_tbl->antenna_type = ANT_BOTH;
- ret = rs_switch_to_mimo(priv, lq_data, search_tbl,
- index);
+ ret = rs_switch_to_mimo(priv, lq_data, conf, sta,
+ search_tbl, index);
if (!ret) {
lq_data->search_better_tbl = 1;
lq_data->action_counter = 0;
@@ -1082,6 +1091,8 @@ static int rs_move_legacy_other(struct iwl_priv *priv,

static int rs_move_siso_to_other(struct iwl_priv *priv,
struct iwl_rate_scale_priv *lq_data,
+ struct ieee80211_conf *conf,
+ struct sta_info *sta,
int index)
{
int ret;
@@ -1122,8 +1133,8 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
search_tbl->is_SGI = 0;
search_tbl->is_fat = 0;
search_tbl->antenna_type = ANT_BOTH;
- ret = rs_switch_to_mimo(priv, lq_data, search_tbl,
- index);
+ ret = rs_switch_to_mimo(priv, lq_data, conf, sta,
+ search_tbl, index);
if (!ret) {
lq_data->search_better_tbl = 1;
goto out;

@@ -1172,6 +1183,8 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,

static int rs_move_mimo_to_other(struct iwl_priv *priv,
struct iwl_rate_scale_priv *lq_data,
+ struct ieee80211_conf *conf,
+ struct sta_info *sta,
int index)
{
int ret;
@@ -1199,8 +1212,8 @@ static int rs_move_mimo_to_other(struct iwl_priv *priv,
else
search_tbl->antenna_type = ANT_AUX;

- ret = rs_switch_to_siso(priv, lq_data, search_tbl,
- index);
+ ret = rs_switch_to_siso(priv, lq_data, conf, sta,
+ search_tbl, index);
if (!ret) {
lq_data->search_better_tbl = 1;
goto out;
@@ -1307,6 +1320,9 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
struct ieee80211_hdr *hdr,
struct sta_info *sta)
{
+ struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+ struct ieee80211_hw *hw = local_to_hw(local);
+ struct ieee80211_conf *conf = &hw->conf;
int low = IWL_RATE_INVALID;
int high = IWL_RATE_INVALID;
int index;
@@ -1545,11 +1561,11 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
lq_data->last_tpt = current_tpt;

if (is_legacy(tbl->lq_type))
- rs_move_legacy_other(priv, lq_data, index);
+ rs_move_legacy_other(priv, lq_data, conf, sta, index);
else if (is_siso(tbl->lq_type))
- rs_move_siso_to_other(priv, lq_data, index);
+ rs_move_siso_to_other(priv, lq_data, conf, sta, index);
else
- rs_move_mimo_to_other(priv, lq_data, index);
+ rs_move_mimo_to_other(priv, lq_data, conf, sta, index);

if (lq_data->search_better_tbl) {
tbl = &(lq_data->lq_info[(1 - lq_data->active_tbl)]);
@@ -1569,7 +1585,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,

if (is_legacy(tbl1->lq_type) &&
#ifdef CONFIG_IWL4965_HT
- !priv->current_assoc_ht.is_ht &&
+ (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE)) &&
#endif
(lq_data->action_counter >= 1)) {
lq_data->action_counter = 0;
@@ -1613,6 +1629,7 @@ out:


static void rs_initialize_lq(struct iwl_priv *priv,
+ struct ieee80211_conf *conf,
struct sta_info *sta)
{
int i;
@@ -1620,7 +1637,7 @@ static void rs_initialize_lq(struct iwl_priv *priv,
struct iwl_scale_tbl_info *tbl;
u8 active_tbl = 0;
int rate_idx;
- u8 use_green = rs_use_green(priv);
+ u8 use_green = rs_use_green(priv, conf);
struct iwl_rate mcs_rate;

if (!sta || !sta->rate_ctrl_priv)
@@ -1689,6 +1706,7 @@ static struct ieee80211_rate *rs_get_rate(void *priv_rate,

int i;
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+ struct ieee80211_conf *conf = &local->hw.conf;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
struct sta_info *sta;
u16 fc;
@@ -1732,7 +1750,7 @@ static struct ieee80211_rate *rs_get_rate(void *priv_rate,
lq->lq.sta_id = sta_id;
lq->lq.rs_table[0].rate_n_flags = 0;
lq->ibss_sta_added = 1;
- rs_initialize_lq(priv, sta);
+ rs_initialize_lq(priv, conf, sta);
}
if (!lq->ibss_sta_added)
goto done;
@@ -1772,6 +1790,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
struct sta_info *sta)
{
int i, j;
+ struct ieee80211_conf *conf = &local->hw.conf;
struct ieee80211_hw_mode *mode = local->oper_hw_mode;
struct iwl_priv *priv = (struct iwl_priv *)priv_rate;
struct iwl_rate_scale_priv *crl = priv_sta;
@@ -1827,19 +1846,21 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
crl->is_dup = 0;
crl->valid_antenna = priv->valid_antenna;
crl->antenna = priv->antenna;
- crl->is_green = rs_use_green(priv);
+ crl->is_green = rs_use_green(priv, conf);
crl->active_rate = priv->active_rate;
crl->active_rate &= ~(0x1000);
crl->active_rate_basic = priv->active_rate_basic;
crl->phymode = priv->phymode;
#ifdef CONFIG_IWL4965_HT
- crl->active_siso_rate = (priv->current_assoc_ht.supp_rates[0] << 1);
- crl->active_siso_rate |= (priv->current_assoc_ht.supp_rates[0] & 0x1);
+ crl->active_siso_rate = (priv->current_ht_config.supp_mcs_set[0] << 1);
+ crl->active_siso_rate |=
+ (priv->current_ht_config.supp_mcs_set[0] & 0x1);
crl->active_siso_rate &= ~((u16)0x2);
crl->active_siso_rate = crl->active_siso_rate << IWL_FIRST_OFDM_RATE;

- crl->active_mimo_rate = (priv->current_assoc_ht.supp_rates[1] << 1);
- crl->active_mimo_rate |= (priv->current_assoc_ht.supp_rates[1] & 0x1);
+ crl->active_mimo_rate = (priv->current_ht_config.supp_mcs_set[1] << 1);
+ crl->active_mimo_rate |=
+ (priv->current_ht_config.supp_mcs_set[1] & 0x1);
crl->active_mimo_rate &= ~((u16)0x2);
crl->active_mimo_rate = crl->active_mimo_rate << IWL_FIRST_OFDM_RATE;
IWL_DEBUG_HT("MIMO RATE 0x%X SISO MASK 0x%X\n", crl->active_siso_rate,
@@ -1852,7 +1873,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
if (priv->assoc_station_added)
priv->lq_mngr.lq_ready = 1;

- rs_initialize_lq(priv, sta);
+ rs_initialize_lq(priv, conf, sta);
}

static void rs_fill_link_cmd(struct iwl_rate_scale_priv *lq_data,
--
1.5.3.3
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2007-11-09 08:02:18

by Ron Rindjunsky

[permalink] [raw]
Subject: [PATCH 05/14] mac80211: adding 802.11n essential A-MPDU addBA capability

This patch adds the capability to identify and answer an add block ACK
request.
As this series of patches only adds HT handling with no aggregations,
(A-MPDU aggregations acceptance is not obligatory according to 802.11n draft)
we are currently sending back a refusal upon this request.

Signed-off-by: Ron Rindjunsky <[email protected]>
---
net/mac80211/ieee80211_sta.c | 130 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 130 insertions(+), 0 deletions(-)

Index: wl2_6_24_HT/net/mac80211/ieee80211_sta.c
===================================================================
--- wl2_6_24_HT.orig/net/mac80211/ieee80211_sta.c
+++ wl2_6_24_HT/net/mac80211/ieee80211_sta.c
@@ -57,6 +57,15 @@

#define ERP_INFO_USE_PROTECTION BIT(1)

+#ifdef CONFIG_MAC80211_HT
+/* mgmt header + 1 byte action code */
+#define IEEE80211_MIN_ACTION_SIZE (24 + 1)
+
+#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
+#define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C
+#define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0
+#endif /* CONFIG_MAC80211_HT */
+
static void ieee80211_send_probe_req(struct net_device *dev, u8 *dst,
u8 *ssid, size_t ssid_len);
static struct ieee80211_sta_bss *
@@ -1003,6 +1012,87 @@ static void ieee80211_auth_challenge(str
elems.challenge_len + 2, 1);
}

+#ifdef CONFIG_MAC80211_HT
+
+static void ieee80211_send_addba_resp(struct net_device *dev, u8 *da, u16 tid,
+ u8 dialog_token, u16 status, u16 policy,
+ u16 buf_size, u16 timeout)
+{
+ struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+ struct ieee80211_if_sta *ifsta = &sdata->u.sta;
+ struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+ struct sk_buff *skb;
+ struct ieee80211_mgmt *mgmt;
+ u16 capab;
+
+ skb = dev_alloc_skb(sizeof(*mgmt) + local->hw.extra_tx_headroom);
+ if (!skb) {
+ printk(KERN_DEBUG "%s: failed to allocate buffer "
+ "for addba resp frame\n", dev->name);
+ return;
+ }
+
+ skb_reserve(skb, local->hw.extra_tx_headroom);
+ mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24);
+ memset(mgmt, 0, 24);
+ memcpy(mgmt->da, da, ETH_ALEN);
+ memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN);
+ if (sdata->type == IEEE80211_IF_TYPE_AP)
+ memcpy(mgmt->bssid, dev->dev_addr, ETH_ALEN);
+ else
+ memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN);
+ mgmt->frame_control = IEEE80211_FC(IEEE80211_FTYPE_MGMT,
+ IEEE80211_STYPE_ACTION);
+
+ skb_put(skb, 1 + sizeof(mgmt->u.action.u.addba_resp));
+ mgmt->u.action.category = WLAN_CATEGORY_BACK;
+ mgmt->u.action.u.addba_resp.action_code = WLAN_ACTION_ADDBA_RESP;
+ mgmt->u.action.u.addba_resp.dialog_token = dialog_token;
+
+ capab = (u16)(policy << 1); /* bit 1 aggregation policy */
+ capab |= (u16)(tid << 2); /* bit 5:2 TID number */
+ capab |= (u16)(buf_size << 6); /* bit 15:6 max size of aggergation */
+
+ mgmt->u.action.u.addba_resp.capab = cpu_to_le16(capab);
+ mgmt->u.action.u.addba_resp.timeout = cpu_to_le16(timeout);
+ mgmt->u.action.u.addba_resp.status = cpu_to_le16(status);
+
+ ieee80211_sta_tx(dev, skb, 0);
+
+ return;
+}
+
+static void ieee80211_sta_process_addba_request(struct net_device *dev,
+ struct ieee80211_mgmt *mgmt,
+ size_t len)
+{
+ struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+ struct sta_info *sta;
+ u16 capab, tid, timeout, ba_policy, buf_size, status;
+ u8 dialog_token;
+
+ sta = sta_info_get(local, mgmt->sa);
+ if (!sta)
+ return;
+
+ /* extract session parameters from addba request frame */
+ dialog_token = mgmt->u.action.u.addba_req.dialog_token;
+ timeout = le16_to_cpu(mgmt->u.action.u.addba_req.timeout);
+
+ capab = le16_to_cpu(mgmt->u.action.u.addba_req.capab);
+ ba_policy = (capab & IEEE80211_ADDBA_PARAM_POLICY_MASK) >> 1;
+ tid = (capab & IEEE80211_ADDBA_PARAM_TID_MASK) >> 2;
+ buf_size = (capab & IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK) >> 6;
+
+ /* TODO - add here aggregation support */
+ status = WLAN_STATUS_REQUEST_DECLINED;
+
+ ieee80211_send_addba_resp(sta->dev, sta->addr, tid, dialog_token,
+ status, 1, buf_size, timeout);
+ sta_info_put(sta);
+}
+
+#endif /* CONFIG_MAC80211_HT */

static void ieee80211_rx_mgmt_auth(struct net_device *dev,
struct ieee80211_if_sta *ifsta,
@@ -1879,6 +1969,37 @@ static void ieee80211_rx_mgmt_probe_req(
ieee80211_sta_tx(dev, skb, 0);
}

+#ifdef CONFIG_MAC80211_HT
+
+void ieee80211_rx_mgmt_action(struct net_device *dev,
+ struct ieee80211_if_sta *ifsta,
+ struct ieee80211_mgmt *mgmt,
+ size_t len)
+{
+ if (len < IEEE80211_MIN_ACTION_SIZE)
+ return;
+
+ switch (mgmt->u.action.category) {
+ case WLAN_CATEGORY_BACK:
+ switch (mgmt->u.action.u.addba_req.action_code) {
+ case WLAN_ACTION_ADDBA_REQ:
+ if (len < (IEEE80211_MIN_ACTION_SIZE +
+ sizeof(mgmt->u.action.u.addba_req)))
+ break;
+ ieee80211_sta_process_addba_request(dev, mgmt, len);
+ break;
+ default:
+ printk(KERN_DEBUG "%s: received unsupported BACK\n",
+ dev->name);
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+#endif /* CONFIG_MAC80211_HT */

void ieee80211_sta_rx_mgmt(struct net_device *dev, struct sk_buff *skb,
struct ieee80211_rx_status *rx_status)
@@ -1908,6 +2029,9 @@ void ieee80211_sta_rx_mgmt(struct net_de
case IEEE80211_STYPE_REASSOC_RESP:
case IEEE80211_STYPE_DEAUTH:
case IEEE80211_STYPE_DISASSOC:
+#ifdef CONFIG_MAC80211_HT
+ case IEEE80211_STYPE_ACTION:
+#endif /* CONFIG_MAC80211_HT */
skb_queue_tail(&ifsta->skb_queue, skb);
queue_work(local->hw.workqueue, &ifsta->work);
return;
@@ -1965,6 +2089,11 @@ static void ieee80211_sta_rx_queued_mgmt
case IEEE80211_STYPE_DISASSOC:
ieee80211_rx_mgmt_disassoc(dev, ifsta, mgmt, skb->len);
break;
+#ifdef CONFIG_MAC80211_HT
+ case IEEE80211_STYPE_ACTION:
+ ieee80211_rx_mgmt_action(dev, ifsta, mgmt, skb->len);
+ break;
+#endif /* CONFIG_MAC80211_HT */
}

kfree_skb(skb);
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2007-11-19 13:29:40

by Ron Rindjunsky

[permalink] [raw]
Subject: Re: [PATCH 06/14] mac80211: adding 802.11n essential A-MSDU Rxcapability

first patch (altering the handlers with no 11n code yet) has been
released. if it is ok i will change the amsdu handler accordingly
ron

> > > Would appreciate your opinion for next possible solution:
> > > I'll Move ieee80211_rx_h_data_agg before ieee80211_rx_h_802_1x_pae, and
> > > assuming I identify A-MSDU, I'll loop for each internal MSDU on:
> > > ieee80211_rx_h_802_1x_pae
> > > ieee80211_rx_h_drop_unencrypted
> > > ieee80211_rx_h_data
> > > return value of ieee80211_rx_h_data_agg to
> > > __ieee80211_invoke_rx_handlers will be this small loop's return value
> >
> > I'm not sure I'd like to see such a thing. One thing I'm generally
> > unhappy with here is how the handlers are in a list but there isn't a
> > point in adding/removing any. Also, I'm not convinced that what you're
> > saying will actually work because the handlers expect 802.11 frames so
> > you'd have to make 802.11 frames out of the 802.3 frames you get...
>
> When working with a proprietary (pre-802.11n) frame aggregation, we
> ended up doing more or less this, i.e., converting the frames to a list
> of skb's that had generated 802.11 headers and then passing them one by
> one to ieee80211_rx_h_data. I don't know whether I would say that I
> likeed the end result, but at least it seemed to work without major
> problems.
>
> This was assuming that there were never frames that would need special
> handling in the aggregate (i.e., need for special PAE or
> unencrypted/encrypted processing). Since the aggregate was encrypted as
> a single unit, the drop_unencrypted was not an issue. Same was, in
> practice, true for most of PAE processing. I don't think the initial
> EAPOL handshake is an issue, but at least in theory, there could be an
> EAPOL re-authentication happening at some point and if EAPOL frames
> require special processing, this would need to be taken into account.
>
> > What I originally wanted to do for this was to add a new
> > "handle_data_frame" function that operates on 802.3 frames but has all
> > the info available, is called from the rx_h_data handler and
> > incorporates all the three callbacks you list above.That'd be similar to
> > what I did with the crypto code (where we now only have a single handler
> > doing it all rather than a bunch doing different pieces of the
> > functionality)
>
> Please note that data frame handling requires support for four addresses
> and plain 802.3 header would not be sufficient without some additional
> meta data. I would assume this to be doable, but some of the
> functionality will need to moved around to handle the 802.11 specific
> things first (like WDS interface selection) and then pass some meta data
> in addition to the frame. This would get relatively close to the
> MA-UNITDATA service primitives from the MAC (which do indeed only pass
> two addresses; 802.3 header would just be one example of how this
> information can be passed).
>
> > You should be able to do this in the code right now because I removed
> > the management interface and hence EAPOL frames aren't handled
> > specially. Hostapd wants to have eapol frames on the management
> > interface and 802.11 framed, but I don't understand that and would
> > rather have it be done differently.
>
> As long as the issues with encrypted vs. unencrypted frames can be
> resolved for both TX and RX in a way that handles the 802.1X and WPA
> cases, it should be fine passing EAPOL frames as normal data frames. In
> addition, bridging code should be told not to bridge this ethertype if
> that has not been done yet.
>
> --
> Jouni Malinen PGP id EFC895FA

2007-11-11 20:20:29

by Ron Rindjunsky

[permalink] [raw]
Subject: RE: [PATCH 03/14] mac80211: adding 802.11n HT framework definitions

>> enum ieee80211_conf_flags {
>> IEEE80211_CONF_SHORT_SLOT_TIME = 1<<0,
>> IEEE80211_CONF_RADIOTAP = 1<<1,
>> +#ifdef CONFIG_MAC80211_HT
>> + IEEE80211_CONF_SUPPORT_HT_MODE = 1<<2,
>> +#endif /* CONFIG_MAC80211_HT */

> Why is this a configuration item? Does the PHY save power if you run
it
> only in 802.11a/b/g modes rather than N?

Most likely it will save power, because HT MIMO demands both antennas to
be active. In a/b/g PHY can allow itself to use a single antenna.

Ron

> Also, I don't think we should have the ifdef there.

Will be removed.

> johannes
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2007-11-12 16:36:23

by Johannes Berg

[permalink] [raw]
Subject: RE: [PATCH 07/14] mac80211: adding 802.11n configuration flows



> Now, I began to work on a solution for this problem (please refer to my
> RFC "mac80211: [RFC] adding bss_config to low level driver ops"), in
> which I wanted to unite all IE changes into one callback.

Oh right, I completely forgot about that, sorry. I should take another
look, or would you like to repost that?

> If Michael is
> already working on a more general solution for all "config" callbacks I
> would be happy to contribute to his effort, or even continue my RFC to a
> more solid patch, but until this will occur I just used similar approach
> to already existing callbacks.

I don't really know if he's working on it and I guess that if he is he'd
take your work as a base.

johannes


Attachments:
signature.asc (828.00 B)
This is a digitally signed message part

2007-11-09 08:02:21

by Ron Rindjunsky

[permalink] [raw]
Subject: [PATCH 01/14] mac80211: adding MAC80211_HT config variable

This patch adds MAC80211_HT and MAC80211_HT_DEBUG config variables
to separate HT features

Signed-off-by: Ron Rindjunsky <[email protected]>
---
net/mac80211/Kconfig | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)

Index: wl2_6_24_HT/net/mac80211/Kconfig
===================================================================
--- wl2_6_24_HT.orig/net/mac80211/Kconfig
+++ wl2_6_24_HT/net/mac80211/Kconfig
@@ -32,6 +32,13 @@ config MAC80211_LEDS
This option enables a few LED triggers for different
packet receive/transmit events.

+config MAC80211_HT
+ bool "Enable 802.11n HT Features"
+ depends on MAC80211
+ ---help---
+ This option enables 802.11n High Throughput features
+ such as MIMO, AMPDU and AMSDU aggregation
+
config MAC80211_DEBUGFS
bool "Export mac80211 internals in DebugFS"
depends on MAC80211 && DEBUG_FS
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2007-11-09 08:02:21

by Ron Rindjunsky

[permalink] [raw]
Subject: [PATCH 07/14] mac80211: adding 802.11n configuration flows

This patch configures the 802.11n mode of operation
internally in ieee80211_conf structure and in the low-level
driver as well (through op conf_ht).
It does not include AP configuration flows.

Signed-off-by: Ron Rindjunsky <[email protected]>
---
include/net/mac80211.h | 5 ++++
net/mac80211/ieee80211.c | 51 ++++++++++++++++++++++++++++++++++++++++++
net/mac80211/ieee80211_i.h | 5 ++++
net/mac80211/ieee80211_sta.c | 38 +++++++++++++++++++++++++++++++
4 files changed, 99 insertions(+), 0 deletions(-)

Index: wl2_6_24_HT/include/net/mac80211.h
===================================================================
--- wl2_6_24_HT.orig/include/net/mac80211.h
+++ wl2_6_24_HT/include/net/mac80211.h
@@ -1050,6 +1050,8 @@ enum ieee80211_erp_change_flags {
* @tx_last_beacon: Determine whether the last IBSS beacon was sent by us.
* This is needed only for IBSS mode and the result of this function is
* used to determine whether to reply to Probe Requests.
+ *
+ * @conf_ht: Configures low level driver with 802.11n HT data. Must be atomic.
*/
struct ieee80211_ops {
int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb,
@@ -1095,6 +1097,9 @@ struct ieee80211_ops {
struct sk_buff *skb,
struct ieee80211_tx_control *control);
int (*tx_last_beacon)(struct ieee80211_hw *hw);
+#ifdef CONFIG_MAC80211_HT
+ int (*conf_ht)(struct ieee80211_hw *hw, struct ieee80211_conf *conf);
+#endif /* CONFIG_MAC80211_HT */
};

/**
Index: wl2_6_24_HT/net/mac80211/ieee80211.c
===================================================================
--- wl2_6_24_HT.orig/net/mac80211/ieee80211.c
+++ wl2_6_24_HT/net/mac80211/ieee80211.c
@@ -534,6 +534,59 @@ int ieee80211_hw_config(struct ieee80211
return ret;
}

+#ifdef CONFIG_MAC80211_HT
+
+/**
+ * ieee80211_hw_config_ht should be used only after legacy configuration
+ * has been determined, as ht configuration depends upon the hardware's
+ * HT abilities for a _specific_ band.
+ */
+int ieee80211_hw_config_ht(struct ieee80211_local *local, int enable_ht,
+ struct ieee80211_ht_info *req_ht_cap,
+ struct ieee80211_ht_bss_info *req_bss_cap)
+{
+ struct ieee80211_conf *conf = &local->hw.conf;
+ struct ieee80211_hw_mode *mode = conf->mode;
+ int i;
+
+ /* HT is not supported */
+ if (!mode->ht_info.ht_supported) {
+ conf->flags &= ~(IEEE80211_CONF_SUPPORT_HT_MODE);
+ return -EOPNOTSUPP;
+ }
+
+ /* disable HT */
+ if (!enable_ht) {
+ conf->flags &= ~(IEEE80211_CONF_SUPPORT_HT_MODE);
+ } else {
+ conf->flags |= IEEE80211_CONF_SUPPORT_HT_MODE;
+ conf->ht_conf.cap = req_ht_cap->cap & mode->ht_info.cap;
+ conf->ht_conf.cap &= ~(IEEE80211_HT_CAP_MIMO_PS);
+ conf->ht_conf.cap |=
+ mode->ht_info.cap & IEEE80211_HT_CAP_MIMO_PS;
+ conf->ht_bss_conf.primary_channel =
+ req_bss_cap->primary_channel;
+ conf->ht_bss_conf.bss_cap = req_bss_cap->bss_cap;
+ conf->ht_bss_conf.bss_op_mode = req_bss_cap->bss_op_mode;
+ for (i = 0; i < 16; i++)
+ conf->ht_conf.supp_mcs_set[i] =
+ mode->ht_info.supp_mcs_set[i] &
+ req_ht_cap->supp_mcs_set[i];
+
+ /* In STA mode, this gives us indication
+ * to the AP's mode of operation */
+ conf->ht_conf.ht_supported = 1;
+ conf->ht_conf.ampdu_factor = req_ht_cap->ampdu_factor;
+ conf->ht_conf.ampdu_density = req_ht_cap->ampdu_density;
+ }
+
+ local->ops->conf_ht(local_to_hw(local), &local->hw.conf);
+
+ return 0;
+}
+
+#endif /* CONFIG_MAC80211_HT */
+
void ieee80211_erp_info_change_notify(struct net_device *dev, u8 changes)
{
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
Index: wl2_6_24_HT/net/mac80211/ieee80211_i.h
===================================================================
--- wl2_6_24_HT.orig/net/mac80211/ieee80211_i.h
+++ wl2_6_24_HT/net/mac80211/ieee80211_i.h
@@ -711,6 +711,11 @@ int ieee80211_if_update_wds(struct net_d
void ieee80211_if_setup(struct net_device *dev);
struct ieee80211_rate *ieee80211_get_rate(struct ieee80211_local *local,
int phymode, int hwrate);
+#ifdef CONFIG_MAC80211_HT
+int ieee80211_hw_config_ht(struct ieee80211_local *local, int enable_ht,
+ struct ieee80211_ht_info *req_ht_cap,
+ struct ieee80211_ht_bss_info *req_bss_cap);
+#endif /* CONFIG_MAC80211_HT */

/* ieee80211_ioctl.c */
extern const struct iw_handler_def ieee80211_iw_handler_def;
Index: wl2_6_24_HT/net/mac80211/ieee80211_sta.c
===================================================================
--- wl2_6_24_HT.orig/net/mac80211/ieee80211_sta.c
+++ wl2_6_24_HT/net/mac80211/ieee80211_sta.c
@@ -1451,6 +1451,21 @@ static void ieee80211_rx_mgmt_assoc_resp
}
sta->supp_rates = rates;

+#ifdef CONFIG_MAC80211_HT
+ if (elems.ht_cap_elem && elems.ht_info_elem && elems.wmm_param &&
+ local->ops->conf_ht) {
+ struct ieee80211_ht_bss_info bss_info;
+
+ ieee80211_ht_cap_ie_to_ht_info(
+ (struct ieee80211_ht_cap *)
+ elems.ht_cap_elem, &sta->ht_info);
+ ieee80211_ht_addt_info_ie_to_ht_bss_info(
+ (struct ieee80211_ht_addt_info *)
+ elems.ht_info_elem, &bss_info);
+ ieee80211_hw_config_ht(local, 1, &sta->ht_info, &bss_info);
+ }
+#endif /* CONFIG_MAC80211_HT */
+
rate_control_rate_init(sta, local);

if (elems.wmm_param && (ifsta->flags & IEEE80211_STA_WMM_ENABLED)) {
@@ -1866,6 +1881,10 @@ static void ieee80211_rx_mgmt_beacon(str
struct ieee80211_if_sta *ifsta;
size_t baselen;
struct ieee802_11_elems elems;
+#ifdef CONFIG_MAC80211_HT
+ struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+ struct ieee80211_conf *conf = &local->hw.conf;
+#endif /* CONFIG_MAC80211_HT */

ieee80211_rx_bss_info(dev, mgmt, len, rx_status, 1);

@@ -1888,6 +1907,25 @@ static void ieee80211_rx_mgmt_beacon(str
if (elems.erp_info && elems.erp_info_len >= 1)
ieee80211_handle_erp_ie(dev, elems.erp_info[0]);

+#ifdef CONFIG_MAC80211_HT
+ if (elems.ht_cap_elem && elems.ht_info_elem &&
+ elems.wmm_param && local->ops->conf_ht &&
+ conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) {
+ struct ieee80211_ht_bss_info bss_info;
+
+ ieee80211_ht_addt_info_ie_to_ht_bss_info(
+ (struct ieee80211_ht_addt_info *)
+ elems.ht_info_elem, &bss_info);
+ /* check if AP changed bss inforamation */
+ if ((conf->ht_bss_conf.primary_channel !=
+ bss_info.primary_channel) ||
+ (conf->ht_bss_conf.bss_cap != bss_info.bss_cap) ||
+ (conf->ht_bss_conf.bss_op_mode != bss_info.bss_op_mode))
+ ieee80211_hw_config_ht(local, 1, &conf->ht_conf,
+ &bss_info);
+ }
+#endif /* CONFIG_MAC80211_HT */
+
if (elems.wmm_param && (ifsta->flags & IEEE80211_STA_WMM_ENABLED)) {
ieee80211_sta_wmm_params(dev, ifsta, elems.wmm_param,
elems.wmm_param_len);
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2007-11-13 16:31:26

by Johannes Berg

[permalink] [raw]
Subject: RE: [PATCH 06/14] mac80211: adding 802.11n essential A-MSDURxcapability


> > I'm not sure I'd like to see such a thing. One thing I'm generally
> > unhappy with here is how the handlers are in a list but there isn't a
> > point in adding/removing any. Also, I'm not convinced that what you're
> > saying will actually work because the handlers expect 802.11 frames so
> > you'd have to make 802.11 frames out of the 802.3 frames you get...
>
> True, it is a drawback, as I'll have to create 802.11 frames instead of
> 802.3 (with important data duplicated into all of them), but then I'll
> just call ieee80211_invoke_rx_handlers with ieee80211_rx_handler
> pointed to
> local->rx_handlers[ieee80211_rx_h_802_1x_pae]. Then I won't have to
> change any existing handler except of my new ieee80211_rx_h_amsdu
> Do you think this approach makes sense?

I'm not convinced. That seems fairly ad-hoc and likely to break in the
future because only parts of the 802.11 header can be reconstructed.

> Do you mean ieee80211_rx_h_decrypt?
> If yes, I see it uses 3 different decrypt schemes. Here I have one
> scheme reaping it self over and over.

Yeah, this used to have four or five different RX handlers.

johannes


Attachments:
signature.asc (828.00 B)
This is a digitally signed message part

2007-11-09 20:18:39

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 05/14] mac80211: adding 802.11n essential A-MPDU addBA capability


> As this series of patches only adds HT handling with no aggregations,
> (A-MPDU aggregations acceptance is not obligatory according to 802.11n draft)
> we are currently sending back a refusal upon this request.

Heh. In the Kconfig you just wrote that it handles AMPDU and AMSDU
aggregation which I'd expect to imply deaggregation too. Nothing
serious, just seemed a bit weird! :)

And isn't one of the two (I always forget which one) rather a feature of
the hardware?

> +#ifdef CONFIG_MAC80211_HT
> +/* mgmt header + 1 byte action code */
> +#define IEEE80211_MIN_ACTION_SIZE (24 + 1)
> +
> +#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
> +#define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C
> +#define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0
> +#endif /* CONFIG_MAC80211_HT */

Leave out the ifdefs please when they only protect definitions or such,
i.e. nothing that will generate code/allocate structure space.


> + capab |= (u16)(buf_size << 6); /* bit 15:6 max size of aggergation */

typo: aggregation. Interesting what an email program with a spell
checker makes you notice :) (No, I'm not suggesting you run a spell
checker, I'm rather saying that I probably wouldn't have noticed
otherwise)

> +static void ieee80211_sta_process_addba_request(struct net_device *dev,


> + /* TODO - add here aggregation support */

I think that comment is misleading. We don't add aggregation support
here but rather when adding it we must change this code, but anyway.
Don't bother.

> + printk(KERN_DEBUG "%s: received unsupported BACK\n",
> + dev->name);

net_ratelimit() please, otherwise people can flood our logs by just
sending us strange frames.

Btw. I'd like to remove code from ieee80211_sta.c rather than add this
much. Do you see any way to partition your code differently? The
ieee80211_sta.c file is a huge file and barely understandable when you
just read it... I was at one time working on extracting the scan code
out from it and keep only MLME stuff in there. My goal was to be able to
not compile ieee80211_sta.c unless the user wanted the in-kernel MLME,
but maybe I should rather put the MLME into a new file then. I'd
appreciate if you could give it (partitioning the code otherwise) a
thought, but I promise I won't be disappointed if you don't want to do
it.

johannes


Attachments:
signature.asc (828.00 B)
This is a digitally signed message part

2007-11-09 08:02:18

by Ron Rindjunsky

[permalink] [raw]
Subject: [PATCH 09/14] iwlwifi: 802.11n configuring hw_mode parameters to support HT in A/G

This patch fills the mac80211's ieee80211_hw_mode structures with the
needed 802.11n data needed for the new framework

Signed-off-by: Ron Rindjunsky <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-4965.c | 32 ++++++++++++++++++++------
drivers/net/wireless/iwlwifi/iwl-4965.h | 4 +-
drivers/net/wireless/iwlwifi/iwl4965-base.c | 26 ++++++----------------
3 files changed, 33 insertions(+), 29 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index fed2357..0a6f6ec 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -3668,6 +3668,30 @@ static int parse_elems(u8 *start, size_t len, struct ieee802_11_elems *elems)

return 0;
}
+
+void iwl4965_init_ht_hw_capab(struct ieee80211_ht_info *ht_info, int mode)
+{
+ ht_info->cap = 0;
+ memset(ht_info->supp_mcs_set, 0, 16);
+
+ ht_info->ht_supported = 1;
+
+ if (mode == MODE_IEEE80211A) {
+ ht_info->cap |= (u16)IEEE80211_HT_CAP_SUP_WIDTH;
+ ht_info->cap |= (u16)IEEE80211_HT_CAP_SGI_40;
+ ht_info->supp_mcs_set[4] = 0x01;
+ }
+ ht_info->cap |= (u16)IEEE80211_HT_CAP_GRN_FLD;
+ ht_info->cap |= (u16)IEEE80211_HT_CAP_SGI_20;
+ ht_info->cap |= (u16)(IEEE80211_HT_CAP_MIMO_PS &
+ (IWL_MIMO_PS_NONE << 2));
+
+ ht_info->ampdu_factor = CFG_HT_RX_AMPDU_FACTOR_DEF;
+ ht_info->ampdu_density = CFG_HT_MPDU_DENSITY_DEF;
+
+ ht_info->supp_mcs_set[0] = 0xFF;
+ ht_info->supp_mcs_set[1] = 0xFF;
+}
#endif /* CONFIG_IWL4965_HT */

static void iwl4965_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id)
@@ -4269,14 +4293,6 @@ static int iwl4965_tx_queue_agg_disable(struct iwl_priv *priv, u16 txq_id,

#endif/* CONFIG_IWL4965_HT_AGG */
#endif /* CONFIG_IWL4965_HT */
-/*
- * RATE SCALE CODE
- */
-int iwl4965_init_hw_rates(struct iwl_priv *priv, struct ieee80211_rate *rates)
-{
- return 0;
-}
-

/**
* iwl4965_add_station - Initialize a station's hardware rate table
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h
index 71cd2b7..4a54aad 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.h
@@ -750,8 +750,6 @@ extern int iwl4965_tx_cmd(struct iwl_priv *priv, struct iwl_cmd *out_cmd,
u8 sta_id, dma_addr_t txcmd_phys,
struct ieee80211_hdr *hdr, u8 hdr_len,
struct ieee80211_tx_control *ctrl, void *sta_in);
-extern int iwl4965_init_hw_rates(struct iwl_priv *priv,
- struct ieee80211_rate *rates);
extern int iwl4965_alive_notify(struct iwl_priv *priv);
extern void iwl4965_update_rate_scaling(struct iwl_priv *priv, u8 mode);
extern void iwl4965_set_ht_add_station(struct iwl_priv *priv, u8 index);
@@ -766,6 +764,8 @@ extern int iwl4965_set_fat_chan_info(struct iwl_priv *priv, int phymode,
extern void iwl4965_rf_kill_ct_config(struct iwl_priv *priv);

#ifdef CONFIG_IWL4965_HT
+extern void iwl4965_init_ht_hw_capab(struct ieee80211_ht_info *ht_info,
+ int mode);
#ifdef CONFIG_IWL4965_HT_AGG
extern int iwl_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da,
u16 tid, u16 *start_seq_num);
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index d9f918b..1d0946f 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -5626,8 +5626,6 @@ static void iwl_init_hw_rates(struct iwl_priv *priv,
if (IWL_BASIC_RATES_MASK & (1 << i))
rates[i].flags |= IEEE80211_RATE_BASIC;
}
-
- iwl4965_init_hw_rates(priv, rates);
}

/**
@@ -5645,10 +5643,8 @@ static int iwl_init_geos(struct iwl_priv *priv)
A = 0,
B = 1,
G = 2,
- A_11N = 3,
- G_11N = 4,
};
- int mode_count = 5;
+ int mode_count = 3;

if (priv->modes) {
IWL_DEBUG_INFO("Geography modes already initialized.\n");
@@ -5688,6 +5684,9 @@ static int iwl_init_geos(struct iwl_priv *priv)
modes[A].num_rates = 8; /* just OFDM */
modes[A].rates = &rates[4];
modes[A].num_channels = 0;
+#ifdef CONFIG_IWL4965_HT
+ iwl4965_init_ht_hw_capab(&modes[A].ht_info, MODE_IEEE80211A);
+#endif

modes[B].mode = MODE_IEEE80211B;
modes[B].channels = channels;
@@ -5700,18 +5699,9 @@ static int iwl_init_geos(struct iwl_priv *priv)
modes[G].rates = rates;
modes[G].num_rates = 12; /* OFDM & CCK */
modes[G].num_channels = 0;
-
- modes[G_11N].mode = MODE_IEEE80211G;
- modes[G_11N].channels = channels;
- modes[G_11N].num_rates = 13; /* OFDM & CCK */
- modes[G_11N].rates = rates;
- modes[G_11N].num_channels = 0;
-
- modes[A_11N].mode = MODE_IEEE80211A;
- modes[A_11N].channels = &channels[ARRAY_SIZE(iwl_eeprom_band_1)];
- modes[A_11N].rates = &rates[4];
- modes[A_11N].num_rates = 9; /* just OFDM */
- modes[A_11N].num_channels = 0;
+#ifdef CONFIG_IWL4965_HT
+ iwl4965_init_ht_hw_capab(&modes[G].ht_info, MODE_IEEE80211G);
+#endif

priv->ieee_channels = channels;
priv->ieee_rates = rates;
@@ -5731,11 +5721,9 @@ static int iwl_init_geos(struct iwl_priv *priv)

if (is_channel_a_band(ch)) {
geo_ch = &modes[A].channels[modes[A].num_channels++];
- modes[A_11N].num_channels++;
} else {
geo_ch = &modes[B].channels[modes[B].num_channels++];
modes[G].num_channels++;
- modes[G_11N].num_channels++;
}

geo_ch->freq = ieee80211chan2mhz(ch->channel);
--
1.5.3.3
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2007-11-11 20:22:06

by Ron Rindjunsky

[permalink] [raw]
Subject: RE: [PATCH 02/14] mac80211: adding 802.11n definitions inieee80211.h

>> +struct ieee80211_bar {

Yes you are right, that is abbreviated for Block ACK Request

>> +struct ieee80211_ht_addt_info {

That's shortening for "HT additional info" which refers to 802.11n draft
section 7.3.2.53 "HT Information element".

The problem with this name results from terms confusion (IMHO) in the
draft.
Section 7.3.2.52 defines both "HT capabilities element" and "HT
Information element", but both are sent during association/beaconing, so
one may regard both as "information elements" (in classic IE way of
looking at them).

So currently ieee80211_ht_cap relates to "HT capabilities element" and
ieee80211_ht_addt_info relates to "HT Information element"
If anyone can think of a better naming convention to avoid confusion -
will be most appreciated.

Ron

> I'd appreciate comments what the abbreviations mean. I know bar (block
> ack request) but not sure about addt (add TS?)

Comments will be added

> johannes
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2007-11-09 20:19:10

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 12/14] iwlwifi: 802.11n comply HT add station flow with mac80211 framework


> + /* TODO - consider checking if mac80211 will allow
> + * to query its station table - will help here */

Care to explain what you mean and how it'd help?

johannes


Attachments:
signature.asc (828.00 B)
This is a digitally signed message part

2007-11-09 08:02:19

by Ron Rindjunsky

[permalink] [raw]
Subject: [PATCH 06/14] mac80211: adding 802.11n essential A-MSDU Rx capability

This patch adds the ability to receive and handle A-MSDU frames.

Signed-off-by: Ron Rindjunsky <[email protected]>
---
net/mac80211/ieee80211_i.h | 1 +
net/mac80211/rx.c | 220 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 221 insertions(+), 0 deletions(-)

Index: wl2_6_24_HT/net/mac80211/ieee80211_i.h
===================================================================
--- wl2_6_24_HT.orig/net/mac80211/ieee80211_i.h
+++ wl2_6_24_HT/net/mac80211/ieee80211_i.h
@@ -157,6 +157,7 @@ struct ieee80211_txrx_data {
int load;
u32 tkip_iv32;
u16 tkip_iv16;
+ u16 amsdu_frame;
} rx;
} u;
};
Index: wl2_6_24_HT/net/mac80211/rx.c
===================================================================
--- wl2_6_24_HT.orig/net/mac80211/rx.c
+++ wl2_6_24_HT/net/mac80211/rx.c
@@ -243,6 +243,10 @@ ieee80211_rx_h_parse_qos(struct ieee8021
u8 *qc = data + ieee80211_get_hdrlen(rx->fc) - QOS_CONTROL_LEN;
/* frame has qos control */
tid = qc[0] & QOS_CONTROL_TID_MASK;
+ if (qc[0] & IEEE80211_QOS_CONTROL_A_MSDU_PRESENT)
+ rx->u.rx.amsdu_frame = 1;
+ else
+ rx->u.rx.amsdu_frame = 0;
} else {
if (unlikely((rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT)) {
/* Separate TID for management frames */
@@ -1007,6 +1011,219 @@ ieee80211_rx_h_drop_unencrypted(struct i
return TXRX_CONTINUE;
}

+#ifdef CONFIG_MAC80211_HT
+
+static ieee80211_txrx_result
+ieee80211_rx_h_data_agg(struct ieee80211_txrx_data *rx)
+{
+ struct net_device *dev = rx->dev;
+ struct ieee80211_local *local = rx->local;
+ u16 fc, hdrlen, ethertype;
+ u8 *payload;
+ struct sk_buff *skb = rx->skb, *skb2, *frame = NULL;
+ struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+ const struct ethhdr *eth;
+ int remaining;
+ u8 dst[ETH_ALEN];
+ u8 src[ETH_ALEN];
+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data;
+ DECLARE_MAC_BUF(mac);
+
+ fc = rx->fc;
+ if (unlikely((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA))
+ return TXRX_CONTINUE;
+
+ if (unlikely(!WLAN_FC_DATA_PRESENT(fc)))
+ return TXRX_DROP;
+
+ if (!rx->u.rx.amsdu_frame)
+ return TXRX_CONTINUE;
+
+ hdrlen = ieee80211_get_hdrlen(fc);
+
+ switch (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
+ case IEEE80211_FCTL_TODS:
+ /* BSSID SA DA */
+ if (unlikely(sdata->type != IEEE80211_IF_TYPE_AP &&
+ sdata->type != IEEE80211_IF_TYPE_VLAN)) {
+ printk(KERN_DEBUG "%s: dropped ToDS frame (BSSID=%s"
+ " SA=%s DA=%s)\n",
+ dev->name, print_mac(mac, hdr->addr1),
+ print_mac(mac, hdr->addr2),
+ print_mac(mac, hdr->addr3));
+ return TXRX_DROP;
+ }
+ break;
+ case (IEEE80211_FCTL_TODS|IEEE80211_FCTL_FROMDS):
+ /* RA TA DA SA */
+ if (unlikely(sdata->type != IEEE80211_IF_TYPE_WDS)) {
+ printk(KERN_DEBUG "%s: dropped FromDS&ToDS frame"
+ " (RA=%s TA=%s DA=%s SA=%s)\n",
+ rx->dev->name, print_mac(mac, hdr->addr1),
+ print_mac(mac, hdr->addr2),
+ print_mac(mac, hdr->addr3),
+ print_mac(mac, hdr->addr4));
+ return TXRX_DROP;
+ }
+ break;
+ case IEEE80211_FCTL_FROMDS:
+ /* DA BSSID SA */
+ if (sdata->type != IEEE80211_IF_TYPE_STA)
+ return TXRX_DROP;
+ break;
+ case 0:
+ /* DA SA BSSID */
+ if (sdata->type != IEEE80211_IF_TYPE_IBSS) {
+ if (net_ratelimit())
+ printk(KERN_DEBUG "%s: dropped IBSS frame"
+ " (DA=%s SA=%s BSSID=%s)\n",
+ dev->name, print_mac(mac, hdr->addr1),
+ print_mac(mac, hdr->addr2),
+ print_mac(mac, hdr->addr3));
+ return TXRX_DROP;
+ }
+ break;
+ }
+
+ if (unlikely((skb->len - hdrlen) < 8)) {
+ if (net_ratelimit())
+ printk(KERN_DEBUG "%s: RX too short data frame "
+ "payload\n", dev->name);
+ return TXRX_DROP;
+ }
+
+ eth = (struct ethhdr *) skb_pull(skb, hdrlen);
+
+ payload = skb->data;
+ ethertype = (payload[6] << 8) | payload[7];
+
+ if (likely((compare_ether_addr(payload, rfc1042_header) == 0 &&
+ ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
+ compare_ether_addr(payload,
+ bridge_tunnel_header) == 0))
+ eth = (struct ethhdr *) skb_pull(skb, 8);
+
+ if (!eth)
+ return TXRX_DROP;
+
+ while (skb != frame) {
+ u8 padding;
+ __be16 len = eth->h_proto;
+ unsigned int subframe_len = sizeof(struct ethhdr) + ntohs(len);
+
+ remaining = skb->len;
+ memcpy(dst, eth->h_dest, ETH_ALEN);
+ memcpy(src, eth->h_source, ETH_ALEN);
+
+ padding = ((4 - subframe_len) & 0x3);
+ /* the last MSDU has no padding */
+ if (subframe_len > remaining) {
+ printk(KERN_DEBUG "%s: wrong buffer size", dev->name);
+ return TXRX_DROP;
+ }
+
+ skb_pull(skb, sizeof(struct ethhdr));
+ /* if last subframe reuse skb */
+ if (remaining <= subframe_len + padding)
+ frame = skb;
+ else {
+ frame = dev_alloc_skb(local->hw.extra_tx_headroom +
+ subframe_len);
+
+ if (frame == NULL)
+ return TXRX_DROP;
+
+ skb_reserve(frame, local->hw.extra_tx_headroom +
+ sizeof(struct ethhdr));
+ memcpy(skb_put(frame, ntohs(len)), skb->data,
+ ntohs(len));
+
+ eth = (struct ethhdr *) skb_pull(skb, ntohs(len) +
+ padding);
+ if (!eth) {
+ printk(KERN_DEBUG "%s: wrong buffer size ",
+ dev->name);
+ dev_kfree_skb(frame);
+ return TXRX_DROP;
+ }
+ }
+ skb2 = NULL;
+
+ payload = frame->data;
+ ethertype = (payload[6] << 8) | payload[7];
+
+ if (likely((compare_ether_addr(payload, rfc1042_header) == 0 &&
+ ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
+ compare_ether_addr(payload,
+ bridge_tunnel_header) == 0)) {
+ /* remove RFC1042 or Bridge-Tunnel
+ * encapsulation and replace EtherType */
+ skb_pull(frame, 6);
+ memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN);
+ memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN);
+ } else {
+ memcpy(skb_push(frame, sizeof(__be16)), &len,
+ sizeof(__be16));
+ memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN);
+ memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN);
+ }
+
+ if (local->bridge_packets &&
+ (sdata->type == IEEE80211_IF_TYPE_AP ||
+ sdata->type == IEEE80211_IF_TYPE_VLAN) &&
+ (rx->flags & IEEE80211_TXRXD_RXRA_MATCH)) {
+ if (is_multicast_ether_addr(frame->data)) {
+ /* send multicast frames both to higher layers
+ * in local net stack and back to the wireless
+ * media */
+ skb2 = skb_copy(frame, GFP_ATOMIC);
+ if (!skb2)
+ printk(KERN_DEBUG "%s: failed to clone"
+ " multicast frame\n", dev->name);
+ } else {
+ struct sta_info *dsta;
+
+ dsta = sta_info_get(local, frame->data);
+ if (dsta && !dsta->dev)
+ printk(KERN_DEBUG "Station with null "
+ "dev structure!\n");
+ else if (dsta && dsta->dev == dev) {
+ /* Destination station is associated
+ *to this AP, so send the frame
+ * directly to it and do not pass
+ * the frame to local net stack.
+ */
+ skb2 = frame;
+ frame = NULL;
+ }
+ if (dsta)
+ sta_info_put(dsta);
+ }
+ }
+ if (frame) {
+ /* deliver to local stack */
+ skb_set_network_header(frame, 0);
+ frame->protocol = eth_type_trans(frame, dev);
+ frame->priority = skb->priority;
+ netif_rx(frame);
+ }
+
+ if (skb2) {
+ /* send to wireless media */
+ skb2->protocol = __constant_htons(ETH_P_802_3);
+ skb_set_network_header(skb2, 0);
+ skb_set_mac_header(skb2, 0);
+ skb2->priority = skb->priority;
+ skb2->dev = dev;
+ dev_queue_xmit(skb2);
+ }
+ }
+
+ return TXRX_QUEUED;
+}
+
+#endif /* CONFIG_MAC80211_HT */
+
static ieee80211_txrx_result
ieee80211_rx_h_data(struct ieee80211_txrx_data *rx)
{
@@ -1343,6 +1560,9 @@ ieee80211_rx_handler ieee80211_rx_handle
ieee80211_rx_h_remove_qos_control,
ieee80211_rx_h_802_1x_pae,
ieee80211_rx_h_drop_unencrypted,
+#ifdef CONFIG_MAC80211_HT
+ ieee80211_rx_h_data_agg,
+#endif /* CONFIG_MAC80211_HT */
ieee80211_rx_h_data,
ieee80211_rx_h_mgmt,
NULL
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2007-11-12 07:34:18

by Ron Rindjunsky

[permalink] [raw]
Subject: RE: [PATCH 01/14] mac80211: adding MAC80211_HT config variable



>> This patch adds MAC80211_HT and MAC80211_HT_DEBUG config variables
>> to separate HT features
>>

> Nah. We don't need more ifdefs. Just leave the code on all the time.
The
> overhead when it's not being used should be minimal and if it's not..
that
> needs to be fixed anyway.

I was thinking of doing it, as patches do not break current drivers, but
wanted to give the option if desired. I do believe that overhead of the
patches when unused is minor, so unless someone will object I can remove
the #ifdefs.

Ron

> Also there doesn't appear to be MAC80211_HT_DEBUG in this patch,
though
> I'd be
> okay with that.

> -Michael Wu
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2007-11-09 20:18:57

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 09/14] iwlwifi: 802.11n configuring hw_mode parameters to support HT in A/G


> + if (mode == MODE_IEEE80211A) {
> + ht_info->cap |= (u16)IEEE80211_HT_CAP_SUP_WIDTH;
> + ht_info->cap |= (u16)IEEE80211_HT_CAP_SGI_40;
> + ht_info->supp_mcs_set[4] = 0x01;
> + }
> + ht_info->cap |= (u16)IEEE80211_HT_CAP_GRN_FLD;
> + ht_info->cap |= (u16)IEEE80211_HT_CAP_SGI_20;
> + ht_info->cap |= (u16)(IEEE80211_HT_CAP_MIMO_PS &
> + (IWL_MIMO_PS_NONE << 2));
> +
> + ht_info->ampdu_factor = CFG_HT_RX_AMPDU_FACTOR_DEF;
> + ht_info->ampdu_density = CFG_HT_MPDU_DENSITY_DEF;
> +
> + ht_info->supp_mcs_set[0] = 0xFF;
> + ht_info->supp_mcs_set[1] = 0xFF;

Good to see an example. I see you're actually using the IEEE80211A mode
as "5 GHz" and IEEE80211G as "2.4 GHz". Big thanks for doing it that way
rather than adding new modes or some weird stuff, this makes it a lot
simpler to abstract it away into bands.

It'll probably look differently with no ht_info part of a band but
rather all the information clustered into a single structure, but this
looks pretty good to me given the current crappy infrastructure.

johannes


Attachments:
signature.asc (828.00 B)
This is a digitally signed message part

2007-11-09 20:18:45

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 06/14] mac80211: adding 802.11n essential A-MSDU Rx capability


> This patch adds the ability to receive and handle A-MSDU frames.

> + u16 amsdu_frame;

Why a u16 of all the available types? Maybe just 'bool'?

> + switch (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
> + case IEEE80211_FCTL_TODS:
> + /* BSSID SA DA */
> + if (unlikely(sdata->type != IEEE80211_IF_TYPE_AP &&
> + sdata->type != IEEE80211_IF_TYPE_VLAN)) {
> + printk(KERN_DEBUG "%s: dropped ToDS frame (BSSID=%s"
> + " SA=%s DA=%s)\n",
> + dev->name, print_mac(mac, hdr->addr1),
> + print_mac(mac, hdr->addr2),
> + print_mac(mac, hdr->addr3));

net_ratelimit()

> + printk(KERN_DEBUG "%s: dropped FromDS&ToDS frame"
> + " (RA=%s TA=%s DA=%s SA=%s)\n",
> + rx->dev->name, print_mac(mac, hdr->addr1),
> + print_mac(mac, hdr->addr2),
> + print_mac(mac, hdr->addr3),
> + print_mac(mac, hdr->addr4));

ditto.

> + if (net_ratelimit())
> + printk(KERN_DEBUG "%s: dropped IBSS frame"
> + " (DA=%s SA=%s BSSID=%s)\n",
> + dev->name, print_mac(mac, hdr->addr1),
> + print_mac(mac, hdr->addr2),
> + print_mac(mac, hdr->addr3));

Heh :)

> + skb_reserve(frame, local->hw.extra_tx_headroom +
> + sizeof(struct ethhdr));

Hah. I knew there was an skb_reserve missing in the original code :)



The one thing I'm not sure about here is the EAPOL frame handling. In
theory, such frames could be part of an aggregation and thus we'll not
get them to the right place. Then again, we haven't decided yet what the
right place is. Also, what happens with 802.1X port control?

johannes


Attachments:
signature.asc (828.00 B)
This is a digitally signed message part

2007-11-09 08:02:20

by Ron Rindjunsky

[permalink] [raw]
Subject: [PATCH 08/14] iwlwifi: 802.11n new framework structures preperation

This patch removes unnecessary or duplicate 802.11n data from structures
in the code, and prepares them for new mac80211's 802.11n framework

Signed-off-by: Ron Rindjunsky <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-4965-rs.c | 2 +-
drivers/net/wireless/iwlwifi/iwl-4965.h | 27 +++++++++++----------------
drivers/net/wireless/iwlwifi/iwl4965-base.c | 2 --
3 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
index 5189788..9d7b029 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
@@ -1824,7 +1824,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
if (local->hw.conf.phymode == MODE_IEEE80211A)
sta->last_txrate += IWL_FIRST_OFDM_RATE;

- crl->is_dup = priv->is_dup;
+ crl->is_dup = 0;
crl->valid_antenna = priv->valid_antenna;
crl->antenna = priv->antenna;
crl->is_green = rs_use_green(priv);
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h
index d61cf0e..71cd2b7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.h
@@ -477,22 +477,23 @@ union iwl_ht_rate_supp {
#define CFG_HT_MPDU_DENSITY_2USEC (0x5)
#define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_2USEC

-struct sta_ht_info {
+struct iwl_ht_info {
+ /* self configuration data */
u8 is_ht;
- u16 rx_mimo_ps_mode;
+ u8 supported_chan_width;
u16 tx_mimo_ps_mode;
- u16 control_channel;
+ u8 is_green_field;
+ u8 sgf;
u8 max_amsdu_size;
u8 ampdu_factor;
u8 mpdu_density;
- u8 operating_mode;
- u8 supported_chan_width;
+ u8 supp_mcs_set[16];
+ /* BSS related data */
+ u8 control_channel;
u8 extension_chan_offset;
- u8 is_green_field;
- u8 sgf;
- u8 supp_rates[16];
u8 tx_chan_width;
- u8 chan_width_cap;
+ u8 ht_protection;
+ u8 non_GF_STA_present;
};
#endif /*CONFIG_IWL4965_HT */

@@ -1151,11 +1152,6 @@ struct iwl_priv {
u8 call_post_assoc_from_beacon;
u8 assoc_station_added;
u8 use_ant_b_for_management_frame; /* Tx antenna selection */
- /* HT variables */
- u8 is_dup;
- u8 is_ht_enabled;
- u8 channel_width; /* 0=20MHZ, 1=40MHZ */
- u8 current_channel_width;
u8 valid_antenna; /* Bit mask of antennas actually connected */
#ifdef CONFIG_IWL4965_SENSITIVITY
struct iwl_sensitivity_data sensitivity_data;
@@ -1165,9 +1161,8 @@ struct iwl_priv {
#endif /*CONFIG_IWL4965_SENSITIVITY*/

#ifdef CONFIG_IWL4965_HT
- struct sta_ht_info current_assoc_ht;
+ struct iwl_ht_info current_ht_config;
#endif
- u8 active_rate_ht[2];
u8 last_phy_res[100];

/* Rate scaling data */
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index f089b06..d9f918b 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -9070,8 +9070,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)

priv->ps_mode = 0;
priv->use_ant_b_for_management_frame = 1; /* start with ant B */
- priv->is_ht_enabled = 1;
- priv->channel_width = IWL_CHANNEL_WIDTH_40MHZ;
priv->valid_antenna = 0x7; /* assume all 3 connected */
priv->ps_mode = IWL_MIMO_PS_NONE;

--
1.5.3.3
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2007-11-12 16:46:54

by Johannes Berg

[permalink] [raw]
Subject: RE: [PATCH 05/14] mac80211: adding 802.11n essential A-MPDU addBAcapability


> Well, aggregation handling is the next step if these patches are
> acceptable... :)

:)

> You are right, A-MPDU is really in the bottom of the data plane
> architecture, so in most cases _creating_ it will be an HW feature,
> while A-MSDU should be implemented in a much higher level place in the
> flow.
> Two reasons why I placed A-MPDU handling in the mac80211:
> - A-MPDU demands a "session" level management (add BACK, del BACK, BAR),
> which looks to me more mac80211 oriented
> - A-MPDU extends the "Access Category" of 11e into "Traffic Identifier"
> (TID) to give finer granularity of frames priority. As mac80211 already
> handles prioritization in wme.c, it looked like a good starting point.

Ok, thanks for the clarification. That means that when you implement
a-mpdu aggregation handling you'll have some way to tell the hardware to
aggregate the next N frames?

> >> + /* TODO - add here aggregation support */
>
> > I think that comment is misleading. We don't add aggregation support
> > here but rather when adding it we must change this code, but anyway.
> > Don't bother.
>
> I can remove that, just a reference for development convenience.

Nah, it's fine. Or maybe rephrase it a bit if you care.

> > Btw. I'd like to remove code from ieee80211_sta.c rather than add this
> > much. Do you see any way to partition your code differently? The
> > ieee80211_sta.c file is a huge file and barely understandable when you
> > just read it... I was at one time working on extracting the scan code
> > out from it and keep only MLME stuff in there. My goal was to be able
> to
>
> As mentioned above - one can treat A-MPDU session as a kind of MLME, so
> this is a rather interesting point. Currently I'll keep the code there,
> and if you see it burdens ieee80211_sta.c just tell me.

Ok, it's fine, I'll look at it a bit more in depth at some other time.

johannes


Attachments:
signature.asc (828.00 B)
This is a digitally signed message part

2007-11-13 16:22:47

by Ron Rindjunsky

[permalink] [raw]
Subject: RE: [PATCH 06/14] mac80211: adding 802.11n essential A-MSDURxcapability


>> I agree. Good point and thanks for the catch.
>> Would appreciate your opinion for next possible solution:
>> I'll Move ieee80211_rx_h_data_agg before ieee80211_rx_h_802_1x_pae,
and
>> assuming I identify A-MSDU, I'll loop for each internal MSDU on:
>> ieee80211_rx_h_802_1x_pae
>> ieee80211_rx_h_drop_unencrypted
>> ieee80211_rx_h_data
>> return value of ieee80211_rx_h_data_agg to
>> __ieee80211_invoke_rx_handlers will be this small loop's return value


> I'm not sure I'd like to see such a thing. One thing I'm generally
> unhappy with here is how the handlers are in a list but there isn't a
> point in adding/removing any. Also, I'm not convinced that what you're
> saying will actually work because the handlers expect 802.11 frames so
> you'd have to make 802.11 frames out of the 802.3 frames you get...

True, it is a drawback, as I'll have to create 802.11 frames instead of
802.3 (with important data duplicated into all of them), but then I'll
just call ieee80211_invoke_rx_handlers with ieee80211_rx_handler
pointed to
local->rx_handlers[ieee80211_rx_h_802_1x_pae]. Then I won't have to
change any existing handler except of my new ieee80211_rx_h_amsdu
Do you think this approach makes sense?

> What I originally wanted to do for this was to add a new
> "handle_data_frame" function that operates on 802.3 frames but has all
> the info available, is called from the rx_h_data handler and

> incorporates all the three callbacks you list above.That'd be similar
to
> what I did with the crypto code (where we now only have a single
handler

Do you mean ieee80211_rx_h_decrypt?
If yes, I see it uses 3 different decrypt schemes. Here I have one
scheme reaping it self over and over.

> doing it all rather than a bunch doing different pieces of the
> functionality)
>
> It'd basically look like this
>
> handle_data_frame
> {
> result = handle_pae()
> if (result == ...)
>
> if (should_drop_unencrypted && is_unencrypted())
> return DROP
>
> ...
> }
>
> and rx_h_data would simply reframe the frame and pass it to this
> function, and your deaggregation handler would loop over this
function.
>
> You should be able to do this in the code right now because I removed
> the management interface and hence EAPOL frames aren't handled
> specially. Hostapd wants to have eapol frames on the management
> interface and 802.11 framed, but I don't understand that and would
> rather have it be done differently.
>
> We may need more discussion, but I believe finding a good solution to
> this is a crucial part of proper support for deaggregation.

> johannes
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2007-11-14 15:14:07

by Ron Rindjunsky

[permalink] [raw]
Subject: Re: [PATCH 06/14] mac80211: adding 802.11n essential A-MSDURxcapability

>>> The one thing I'm not sure about here is the EAPOL frame handling
>>> johannes

>> I agree. Good point and thanks for the catch.
>> assuming I identify A-MSDU, I'll loop for each internal MSDU on:
>> ieee80211_rx_h_802_1x_pae
>> ieee80211_rx_h_drop_unencrypted
>> ieee80211_rx_h_data
>> return value of ieee80211_rx_h_data_agg to
>> __ieee80211_invoke_rx_handlers will be this small loop's return value
>> Do you think this approach makes sense?
>> ron

> I'm not convinced. That seems fairly ad-hoc and likely to break in the
> future because only parts of the 802.11 header can be reconstructed.
> incorporates all the three callbacks you list above.That'd be similar
> what I did with the crypto code (where we now only have a single hndler
> doing it all rather than a bunch doing different pieces of the
> functionality)
>
> It'd basically look like this
>
> handle_data_frame
> {
> result = handle_pae()
> if (result == ...)
>
> if (should_drop_unencrypted && is_unencrypted())
> return DROP
>
> ...
> }
>
> and rx_h_data would simply reframe the frame and pass it to this
> function, and your deaggregation handler would loop over this function.
> johannes

okay. looking in the architecture i think your approach is better, and
this bug should be fixed the way you suggested.
ron