Search Linux Wireless

Re: [PATCH V3] Add iwlwifi wireless drivers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2007-09-06 at 13:00 +0200, Johannes Berg wrote:
> I was just looking through the iwlwifi sources to find out whether it
> can encrypt with a key even if the packet isn't unicast... Anybody know?
> I myself removed the ability to upload multicast/broadcast keys because
> it was so unclear, but it seems that maybe the firmware knows about some
> sort of "virtual broadcast/multicast" station? How about multiple
> broadcast keys for APs with VLANs?
> 
> In any case, I found this comment:
> 
>                 /* XXX: ACK flag must be set for CCMP even if it
>                  * is a multicast/broadcast packet, because CCMP
>                  * group communication encrypted by GTK is
>                  * actually done by the AP. */
>                 cmd->cmd.tx.tx_flags |= TX_CMD_FLG_ACK_MSK;
> 
> and it doesn't make any sense at all. Care to explain? If we're a
> station associated to some other AP, then mac80211 will *obviously* set
> the "expect ack" bit on a "multicast data" packet that's being sent
> since it's actually unicast in 802.11 terms to the AP before it resends
> it using the group key... 

This is what exactly the above comment tells you. The comment speaks for
the non-AP STA mode (the AP code was not there at that time). The
tx_flags is used by the firmware, so whatever mac80211 set its flag, it
has to be translated to the firmware's language -- because you are using
hardware crypto.

> And if we're an AP, this is plain wrong
> (pending a positive answer to the question whether iwlwifi can offload
> broadcast/multicast encryption...) I suggest you remove the comment and
> the tx flags manipulation.

The comment is not for AP mode.

> The same comment is present in the #if 0'ed TKIP code and still talks
> about CCMP. Please!

iwlwifi hardware/firmware only supports partial TKIP (ie. it can do [en|
de]crypt, but cannot build michael_mic), so we comment out the TKIP
hwcrypto code temporarily at this time. I agree the comment should run a
's/CCMP/TKIP/g' though.

> And all the crypto code does:
> 
>                 cmd->cmd.tx.hdr[0].frame_control |=
>                     cpu_to_le16(IEEE80211_FCTL_PROTECTED);
> 
> This is a no-op. Remove it. And while I'm at it, let me say this once
> more: Do *NOT* work around the 802.11 implementation in mac80211 in the
> driver. Fix bugs where there are any, and otherwise don't do work
> mac80211 has done before.

It might be removed, but let me do some test (especially for EAP
packets) first.

> And then I see things like
>                 cmd->cmd.tx.sec_ctl = 1 |       /* WEP */
>                     (ctl->key_idx & 0x3) << 6;
> 
> Please use proper constants for the shifts and masks like everybody
> else. Can't be too hard can it?

OK.

> Generally, the driver needs *LOTS* more comments. While hacking on
> mac80211 it is sometimes important to know what the hardware can handle,
> and I'm unable to answer my initial question using the iwlwifi code. We
> know a lot more about all the chipsets we've reverse engineered and are
> able to judge their capabilities MUCH better than we'll ever be able to
> by looking at the iwlwifi code :(

It is obviously clear, both in the comment and the code: when you get a
GTK, you have already got a PTK anyway. In the non-AP STA mode, you
encypt your packets with PTK (whatever for unicast, broadcast), the AP
receives it and rencrypts them with GTK. Your GTK is used to decrypt for
multicast, broadcast packets.

> I can only guess this is intentional. While I applaud Intel's efforts in
> wireless especially in the light of how some other vendors behave, this
> is suboptimal and basically requires reverse engineering too to figure
> out how things work.

Intentional for what? When you are not able to follow a piece of code,
you think the author intentional mislead you, instead of blaming your
own capability? Arrogant!

> Oh don't get me wrong. There are some comments explaining how things
> work, for example the one about DMA queues. Except that it's not even
> correct:
> 
>  * The four transmit queues allow for performing quality of service (qos)
>  * transmissions as per the 802.11 protocol.  Currently Linux does not
>  * provide a mechanism to the user for utilizing prioritized queues, so
>  * we only utilize the first data transmit queue (queue1).
> 
> No? Why do we have an 802.11 qdisc then and all that stuff?

iwlwifi _does_ honor the ieee80211_tx_control->queue field, I'll delete
the old comment. BTW, the whole 802.11 qdisc hack will be removed with
the multiqueue supported in .24.  

> Further comments below while I'm at it.
> 
>  * mac80211 should also be examined to determine if sta_info is duplicating
>  * the functionality provided here
> 
> absolutely. It also needs a good description of how the firmware manages
> stations. And is this for AP case or just for remote APs?
> 
> In fact, come to think of it, the only thing it does to the hardware is
> iwl_send_add_station so what you really want is a notification from
> mac80211 when a sta_info is added/removed. And for that you build a huge
> amount of station management code into the driver? That all needs to go
> and new features like HT must be folded into mac80211 instead.
> 
>  * NOTE: This initializes the table for a single retry per data rate
>  * which is not optimal.  Setting up an intelligent retry per rate  
>  * requires feedback from transmission, which isn't exposed through 
>  * rc80211_simple which is what this driver is currently using.
> 
> cute. No comment really, speaks for itself.
> 
> iwl_is_fat_tx_allowed and similar stuff needs to be in mac80211.
> 
> static struct ieee80211_ops iwl_hw_ops = {
>         .ht_tx_agg_start = iwl_mac_ht_tx_agg_start,
>         .ht_tx_agg_stop = iwl_mac_ht_tx_agg_stop,
>         .ht_rx_agg_start = iwl_mac_ht_rx_agg_start,
>         .ht_rx_agg_stop = iwl_mac_ht_rx_agg_stop,
> 
> That doesn't seem to be in my mac80211? Did you actually start
> implementing HT features in mac80211? Why are they not available? Why
> clutter the driver with #idef CONFIG_..._HT_AGG when that cannot
> possibly be defined?

We have the HT AGG support in our mac80211. Will submit the patch for
review when we are ready.

>         /* Hard coded to start at the highest retry fallback position
>          * until the 4965 specific rate control algorithm is tied in */
>         tx->initial_rate_index = LINK_QUAL_MAX_RETRY_NUM - 1;
> 
>         /* Alternate between antenna A and B for successive frames */
>         if (priv->use_ant_b_for_management_frame) {
>                 priv->use_ant_b_for_management_frame = 0;
>                 rate_flags = RATE_MCS_ANT_B_MSK;
>         } else {
>                 priv->use_ant_b_for_management_frame = 1;
>                 rate_flags = RATE_MCS_ANT_A_MSK;
>         }
> 
> Again, you were telling us that you absolutely need the rate control
> algorithm tied in with things etc., yet you're not doing it.

I have sent a proposal to reorganize the header files so that we can
export a rate scale interface to the drivers. It is not perfect but it
works. Then we don't like it here and there. If you have a better idea,
why don't you speak it out?

> iwl4965_sign_extend can be implemented a lot better like such:
> 
> static inline s32 sign_extend(u32 value, u8 bits)
> {
> 	u8 shift = 32 - bits;
> 
> 	return (s32)(value << shift) >> shift;
> }

Really? Are you sure this work?

> Note the renamed variables.
> 
>         struct ieee80211_rx_status stats = {
>                 .mactime = le32_to_cpu(rx_start->beacon_time_stamp),
> 
> That beacon_time_start variable looks rather misnamed. Or it shouldn't
> be used here.

OK. I assuem you mentioned the beacon_time_stamp, it should be
->timestamp.

> Enough for now again. 

Please don't. We have given you enough time for commenting the code.
Please do it in a batch like other people did. Don't squeeze a little in
-rc2 and another little in -rc4, ... You are wasting people's time.

> I suggest when you run into problems like the rate
> control algorithm not working well or HT mode missing, you start by
> describing the hardware functionality and the resulting software problem
> to linux-wireless so we can give advice on how to best implement things,
> instead of stuffing tons of code into the driver and then pushing it out

James had done this several months ago. We did everything the mac80211
people suggested, but the patch is still not merged. Do you think we'd
really like to workaound the mac80211 issues in the driver, or even have
our own mac80211 package? Absolutely not, if you mac80211 guys are easy
to work with. Without creating our own mac80211 package, today, the
users are still no better rate scale algorithm selection, no advanced
wireless QoS, no 11N support, not even mention about link aggregation.

> as "hey this works can it be merged?"

Something working is always better than something not working whatever
how beautiful the code looks like. And I believe the current iwlwifi
driver has reached the quality to be merged mainline (both it looks and
it works).

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

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux